AltME: Rebol School

Messages

GiuseppeC
How do I check if ONE has been set to SERIES dynamically ?
type? reduce [mycode]
does not work
GiuseppeC
Here some code is making me crazy:
>> mycode: "ABC"
== "ABC"
>> do reduce [to-set-word mycode copy []]
== []
>> type? ABC
== block!
>> type? get first reduce [to-word codice-temp]
== block!
>> [type? get first reduce [to-word codice-temp]] <> block!
== true
The last one should be FALSE
Ops,
[type? get first reduce [to-word codice-temp]]
should be:
(type? get first reduce [to-word codice-temp])
Now seems to be solved.
GiuseppeC
Following your code
codice-temp: "C001"
do reduce [to-set-word codice-temp copy []]
how do I check dynamically if the series C001 has been created ?
I have tried this
> type? get first [codice-temp]
== string!
But as you see it does not work
sqlab
type?  get to-word codice-temp
sqlab
better to use
do reduce [to-set-word codice-temp 'copy []] or you will
always produce two copies
sorry I just have an non ergonomic keyboard
so
do reduce [to-set-word codice-temp 'copy []]
type?  get to-word codice-temp
GiuseppeC
Thanks, I am exploring dynamic table view creations with my small REBOL knowledge

sqlab
a shorter solution is
set to-word codice-temp copy []

PeterWood
Is this method of providing "private" words in objects reliable?
>> a: make object! [ b: 1 set-b: func[v] [b: v] get-b: func[][b]]
>> o: make object! [set-b: get in a 'set-b get-b: get in a 'get-b]
>> unset 'a
>> o/get-b
== 1
>> o/set-b 2
== 2
>> o/get-b
== 2
Maxim
in R3 yes.. in R2 its almost impossible since you can always get a function's body.
but I prefer this pattern:
>> o: get in context [
[     priv: 1
[     pub: context [ set-b: func[v] [priv: v] b: func[][get 'priv]]
[    ] 'pub
>> o/b
== 1
>> o/set-b 2
== 2
>> o/b
== 2
>> words-of o
== [set-b b]
actually, replace this line in the above:
pub: context [ set-b: func[v] [set 'priv v] b: func[][get 'priv]]

MGilsanz
Can anyone explain  this:
MGilsanz
>> a: 33 * 0.939393939393939
== 31.0
>> b: 31.0
== 31.0
>> to-integer a
== 30
>> to-integer b
== 31
>>
Oldes
http://floating-point-gui.de/
in R3:
>> 33 * 0.939393939393939
== 30.999999999999986

Last message posted 184 weeks ago.