bill wrote:

> Hi all,
>     I was wondering if anyone has a function that will do a find/deep
> on arrays.
>  arrays such as [["AA"] [["B"]["C"]] ["DD"]].
> Bill.
>

Once again I dig into my chainsaw collection.  While not as multipurpose
as 'find, this sucker will tell you if its in there.

deep-find: func [
  "Searches for a particular element in a block, recursing sub-blocks."
  haystack [block!] "Block to search."
  needle [any-type!] "Element to search for."
][
  foreach thing haystack [
    if thing = needle [ return true] ; Ouch!
    if all [ block? thing deep-find thing needle ] [ return true] ; Found
it deep!
  ]
  return false ; Not here!
]


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to