[REBOL] Re: Finding a value in a series?
From: pa:russo:perd at: 21-May-2001 21:08
>How do you do a find on the first element in a series of blocks?
>
>>> probe blk
>[
> [1 a b]
> [2 c d]
> [3 e f]
>]
>
>I want to search for the value 2 and assign the remainder to a variable. I
>then want to delete the record in the series?
>
This is a solution for your specific example:
>> a: [ [1 a b] [2 c d] [3 e f] ]
>> forall a [if (first first a) = 2 [remove a]]
== [
]
>> a: head a
== [
[1 a b]
[3 e f]
]
You can achieve the same result using the line:
forall a [if found? find first a 2 [remove a]]
HTH
--
Paolo Russo
[pa--russo--perd--com]
_________________
PERD s.r.l.
Virtual Technologies for Real Solutions
http://www.perd.com