Similar to the strategy I was thinking, except I'm a fan of the funnier
looking stuff - taking advantage of the "code is data" idea:
(Copied from console then re-spaced for clarity)
>> NewBlock: foreach Val Others: [
[{Bill} 50] [{Jane} 45] [[{Dan} 19] [{Rich} 20]]
] copy/deep [
either block? Val [
append Others Val
][
append [] Val
]
]
== ["Bill" 50 "Jane" 45 "Dan" 19 "Rich" 20]
On Sun, 2007-11-25 at 06:06 +0000, Sunanda wrote:
> Kai:
>
> > What is a good way to transform blocks like
> >
> > [ [ "Bill" 50 ] [ "Jane" 45 ]]
>
> May have fewer side effects than some of the solutions to date:
>
> new-block: copy []
> foreach b [ [ "Bill" 50 ] [ "Jane" 45 ]] [
> append new-block b
> ]
>
> >> new-block
> == ["Bill" 50 "Jane" 45]
>
>
> Though if you want to deblock more nested structures, some more
> work is needed.
>
> Sunanda
>
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.