[REBOL] Re: Newbie Q: Cropping text
From: chalz:earthlink at: 9-Jul-2002 1:35
First off, my thanks to everyone demonstrating The Way Things Work. I don't
get to work in REBOL all that much anymore, so what knowledge I had of it has
dwindled, and I find myself looking at older code of my own and thinking, "Why
did I do that? It works, but *how* does it work?"
> char-sequence: next [a b c d e]
>
> This line has three values - a set-word!, a word! and a block!. When this
> line is evaluated, again a block! series of values will be created, this
> time of five words (a, b, c, d, e). The block! will be at its head (head?
> returns true). Then NEXT is evaluated and it takes the block as input. NEXT
> returns a different block! value - that is the new block! has a different
> index to the original but retains a reference to the same sequence of
> elements. Finally in the evaluation, char-sequence is set to refer to this
> new block! and if you perform INDEX? on char-sequence afterwards, you will
> get the value 2 returned. If you performed FIRST HEAD char-sequence you
> would get the value 'a returned.
Whoah. That.... damn. That's just screwed up. So if I POKE a new value
into the original sequence, the char-seq gets changed as well. Wow. Time to
make prodigious use of COPY, it looks like. *whistles*
> So now this next expression of six values
> a: next b: next c: next sequence: [a b c]
<snip>
> Now if you try printing A you will get an error message. This is because A's
> index is past the tail of the series. But A can still be used try printing
> HEAD A. So in this last example I have made four seperate references to the
> same underlying data series and each of these is referred to by a different
> word (A, B, C and Sequence).
AAAAAIIIIIEEEE!!!!! *gun shot*
> > Thanks for your help, Brett.
>
> My pleasure. I hope the descriptions above are useful and not uselessly
> wordy!
Heh. No, not too wordy. However, I am now frightened of REBOL ;) CarlS is
certainly a madman ;)
--Charles