[REBOL] Re: Confused???
From: carl:cybercraft at: 15-Jul-2002 9:37
On 15-Jul-02, Ed Dana wrote:
> Gregg Irwin wrote:
>> Hi Ed,
>> It's a combination of FORALL and REMOVE that's trippnig you up.
>> FORALL steps through the series (you can see the source for it BTW.
>> It's a mezzanine) using NEXT and REMOVE returns the series at the
>> location *after* the remove, so you're skipping every other element
>> when you combine them.
>>>> b: [1 2 3 4 5 6]
>>>>
>> == [1 2 3 4 5 6]
>>>> forall b [print first b remove b]
>>>>
>> 1
>> 3
>> 5
>> HTH!
> Well it kinda helps. It tell's me why. But it don't tell me how to
> fix the problem. :)
> So what do you recomment I use to parse a mailbox if not ForAll?
> ForEach won't work, unless I'm using it wrong. Which is quite
> possible.
You could perhaps use while instead...
>> b: [1 2 3 4 5 6]
== [1 2 3 4 5 6]
>> while [not empty? b][print first b remove b]
1
2
3
4
5
6
== []
--
Carl Read