Don't try this at home
[1/4] from: ammon:rcslv at: 27-Nov-2002 1:07
Hi,
Has anyone seen a block that looks like this:
[...]
I just discovered it, and I would like to know what it means, it was generated by the
following code:
>> blk: blkr: []
== []
>> foreach word [a b c] [
[ append blkr compose [make (word) []]
[ blkr: third blkr
[ ]
== [make b [...] make c [...]]
>> blk
== [make a [make b [...] make c [...]]]
>> blkr
== [make b [...] make c [...]]
Two things, it shouldn't have given me that result, and if you DO it then the console
dies, no message or anything. Shouldn't it have essentially done this:
>> blk: blkr: []
== []
>> word: 'a
== a
>> append blkr compose [make (word) []]
== [make a []]
>> blkr: third blkr
== []
>> word: 'b
== b
>> append blkr compose [make (word) []]
== [make b []]
>> blkr: third blkr
== []
>> word: 'c
== c
>> append blkr compose [make (word) []]
== [make c []]
>> blk
== [make a [make b [make c []]]]
>>
Any ideas?
Thanks!!
Ammon Johnson --- CIO
Addept ------------------ (www.addept.ws)
435-616-2322 -------- ([ammon--addept--ws])
[2/4] from: ammon:rcslv at: 27-Nov-2002 1:44
HI again!
The answer is a simple COPY/DEEP:
>> foreach word [a b c] [
[ append blkr COPY/DEEP compose [make (word) []]
[ blkr: third blkr
[ ]
That way it gets a new block each time just like the console does. ;-)
Enjoy!!
Ammon Johnson --- CIO
Addept ------------------ (www.addept.ws)
435-616-2322 -------- ([ammon--addept--ws])
----- Original Message -----
From: "Ammon Johnson" <[ammon--rcslv--com]>
To: <[rebol-list--rebol--com]>
Sent: Wednesday, November 27, 2002 1:07 AM
Subject: [REBOL] Don't try this at home
> Hi,
>
> Has anyone seen a block that looks like this:
>
> [...]
>
> I just discovered it, and I would like to know what it means, it was
generated by the following code:
> >> blk: blkr: []
> == []
<<quoted lines omitted: 8>>
> == [make b [...] make c [...]]
> Two things, it shouldn't have given me that result, and if you DO it then
the console dies, no message or anything. Shouldn't it have essentially
done this:
[3/4] from: al:bri:xtra at: 27-Nov-2002 21:55
Ammon wrote:
> Has anyone seen a block that looks like this:
>
> [...]
It's the console (and 'mold-s) attempt to show a block that contains itself
or other blocks that are recursive.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[4/4] from: carl::cybercraft::co::nz at: 27-Nov-2002 22:43
Hi Ammon,
The simpliest way (that I know of) to produce that is this...
>> a: []
== []
>> insert/only a a
== []
>> a
== [[...]]
So, it means a block within itself...
>> length? a
== 1
>> same? a a/1
== true
And I try not to think about it... (:
Carl.
On 27-Nov-02, Ammon Johnson wrote:
> HI again!
> The answer is a simple COPY/DEEP:
<<quoted lines omitted: 63>>
>> Addept ------------------ (www.addept.ws)
>> 435-616-2322 -------- ([ammon--addept--ws])
--
Carl Read
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted