[REBOL] Re: Composing lists in lists
From: volker::nitsch::gmail::com at: 9-Mar-2006 8:07
On 3/9/06, Peter Wood <pwawood-gmail.com> wrote:
> Jeff
>
> Volker's advice applied to your simple example:
>
> >> list: [a b c]
> == [a b c]
> >> append/only newlist: [1] list
append/only newlist: copy[1] list
never forget the copy! That means trouble in rebol.
It is *very* side-effective by default.
Also, In this case i prefer 'compose.
I use it for "templates".
But in a loop appending multiple things 'append is better.
The 'map of rebol is typically:
out: copy[]
foreach val data[
append/only out compose[something]
]
return out
> == [1 [a b c]]
> >> newlist
> == [1 [a b c]]
>
> Regards
>
> Peter
>
> On Thursday, Mar 9, 2006, at 11:59 Asia/Kuala_Lumpur, Volker Nitsch
> wrote:
>
> >
> > Also look for 'append and friends, series-function.
> > Rebol is not pure functional, it happily changes its variables.
> > So blocks (rebols "lists") are usually build by appending values to it,
> > not by composing new blocks.
> > Means you would 'compose the code for a button,
> > but 'append a lot of buttons to a layout.
> >
> > On 3/9/06, Jeff Massung <massung-gmail.com> wrote:
> >> I am a happy man. Thank you. And, I don't know how I missed that.
> >> Thanks
> >> again!
> >>
> >> Jeff M.
>
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>
--
-Volker
Any problem in computer science can be solved with another layer of
indirection. But that usually will create another problem.
David
Wheeler