TO vs MAKE
[1/9] from: brett:codeconscious at: 25-Jun-2003 9:35
> Has anyone investigated what the differences are between TO and MAKE?
> The way they're worded, the only difference seems to be that TO
> converts (the spec?) before constructing the new value, but does
> anyone know of practical differences in behavior?
Not in detail. But this is significant:
>> probe to context [a: 1] [b: 3]
** Script Error: Cannot use to on object! value
** Where: do-boot
** Near: probe to context [a: 1] [b: 3]
>> probe make context [a: 1] [b: 3]
make object! [
a: 1
b: 3
]
Regards,
Brett.
[2/9] from: greggirwin:mindspring at: 24-Jun-2003 17:23
Hi All,
Has anyone investigated what the differences are between TO and MAKE?
The way they're worded, the only difference seems to be that TO
converts (the spec?) before constructing the new value, but does
anyone know of practical differences in behavior?
Thanks!
-- Gregg
[3/9] from: g::santilli::tiscalinet::it at: 25-Jun-2003 10:20
Hi Gregg,
On Wednesday, June 25, 2003, 1:23:43 AM, you wrote:
GI> Has anyone investigated what the differences are between TO and MAKE?
The most evident difference is:
>> make block! 100
== []
>> to block! 100
== [100]
Also, note that MAKE takes a variable number of arguments, so it's
on of the two REBOL's "special" functions (the other is DO), while
TO only takes two arguments AFAIK.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[4/9] from: greggirwin:mindspring at: 25-Jun-2003 9:13
Thanks Gabriele! Thanks Brett!
-- Gregg
[5/9] from: antonr:iinet:au at: 26-Jun-2003 1:22
Gabriele,
Can you show examples of DO and MAKE
using different numbers of arguments?
Anton.
[6/9] from: g:santilli:tiscalinet:it at: 25-Jun-2003 17:58
Hi Anton,
On Wednesday, June 25, 2003, 5:22:22 PM, you wrote:
A> Can you show examples of DO and MAKE
A> using different numbers of arguments?
>> make block! 10 ; two arguments
== []
>> make function! [spec] [code] ; three arguments
>> do :f 1 2 ; three arguments
== 3
The one about DO looks at first debatable, but if you think about
it, you'll see that it is a special behaviour indeed, whether you
consider the other arguments as being taken by DO or not.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[7/9] from: greggirwin:mindspring at: 25-Jun-2003 10:01
Hi Anton,
A> Can you show examples of DO and MAKE
A> using different numbers of arguments?
f: make function! [arg] [print arg]
s: make struct! [a [int] b [short]] none
I'm not sure about DO though. Not enough coffee yet this morning.
-- Gregg
[8/9] from: lmecir:mbox:vol:cz at: 25-Jun-2003 21:36
Hi Anton,
> Can you show examples of DO and MAKE
> using different numbers of arguments?
>
> Anton.
have a look at http://www.fm.vslib.cz/~ladislav/rebol/argstake.html
-L
[9/9] from: antonr:iinet:au at: 26-Jun-2003 16:40
Thanks, guys, very interesting.
Anton.