On 5/11/06, Gregg Irwin <[EMAIL PROTECTED]> wrote:
>
> Hi Volker,
>
> VN> I like that topic. Hard to find the one true universal solution. :)
>
> No kidding; three so far. :)
>
> I have a lot of EMIT functions in places too, and I tried a variant of
> COLLECT that let you define a function, or used a predefined one (e.g.
> EMIT), but then I thought about how REMOVE-EACH and others work,
> because you can't guarantee you won't conflict with a word the user
> needs. I ended up liking the set-word! syntax best myself, because it
> stands out a bit, it's atomic, and it implies an assignment-like
> action.
- 'out and 'emit are typical in Carls code, so i reserve it for that.
I usually see
fn: func [series /local out emit] [
out: copy []
emit: func[val][repend out val] ; or append to string with
newline, whatever
foreach val series [emit val]
out
]
My 'collect is a small wrapper around that.
- option /into : I use that always, thats why i use
collect copy[] [code]
allows also to use a string.
- remove-each is the reason for change-each.
(That second definition, somewhere hidden in my copypasting.)
In Rebol the 'map etc look like loops, so a 'map should do the same IMHO.
Remove-each works like a filter,
remove-each val copy series [code]
instead of the more lisp-like
filter series func[..][..]
So i use not
map series func[..][..]
but
change-each var copy series [code]
(Although, lately i am to lazy to organize with libraries and just use
the wrapper-less
out: copy[] .. return out
and so i lost that implementation again.)
>
> I'm not saying the one I posted is "the one", but I'd like some kind
> of standard collector func in REBOL.
>
> -- Gregg
>
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>
>
--=20
-Volker
"Any problem in computer science can be solved with another layer of
indirection. But that usually will create another problem." David
Wheeler
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.