[REBOL] Re: help with trivial emailgetter
From: greggirwin:mindspring at: 31-Oct-2002 10:56
Hi Bryan,
You got the syntax question answered, so I'll just add a semantic note.
You're doing a REMOVE on the block, then also doing a NEXT to move it
forward, so what's going to happen is that you're going to skip every other
item. Paste this into the console to see what I mean.
messages: [1 2 3 4 5 6]
while [not tail? messages] [
print first messages
remove messages
messages: next messages
]
head messages
On the syntax side, the reason you need to get rid of FIRST you probably
already know now. It returns the first value of a series, not a series
itself, and REMOVE needs a series to operate on. Now, could it ever have
worked? Yes. Try this:
messages: [[1 2 3] [4 5 6]]
remove first messages
head messages
You wouldn't have gotten an error had the first item in your series been a
series itself, but you probably wouldn't have gotten the expected result
either.
HTH!
--Gregg