[REBOL] Re: Is there a REBOL construct similar to the "map" word as used in Logo
From: al:bri:xtra at: 29-Jun-2002 9:39
I forgot to post the 'Arguments script that my 'Map requires.
[
Rebol [
Name: 'Arguments
Title: "Arguments"
File: %"Arguments.r"
Author: "Andrew Martin"
eMail: [Al--Bri--xtra--co--nz]
Date: 22/Mar/2002
]
Arguments: function [
"Returns the arguments of the function."
F [any-function!]
] [
Arguments
] [
Arguments: make block! 2
foreach Argument pick :F 1 [
if refinement? :Argument [
break
]
append Arguments :Argument
]
Arguments
]
]
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
-><-
----- Original Message -----
From: "Gerard Cote" <[gerardcote--sympatico--ca]>
To: <[rebol-list--rebol--com]>
Sent: Saturday, June 29, 2002 4:14 AM
Subject: [REBOL] Re: Is there a REBOL construct similar to the "map" word as
used in Logo ?
> Andrew wrote :
>
> ----- Original Message -----
> From: "Andrew Martin" <[Al--Bri--xtra--co--nz]>
> To: <[rebol-list--rebol--com]>
> Sent: Friday, June 28, 2002 12:28 AM
> Subject: [REBOL] Re: Is there a REBOL construct similar to the "map" word
as used in Logo ?
>
> > This 'Map function might be suitable for your requirements. Thanks again
to
> > Joel and Ladislav!
> > [
> > Rebol [
> > Name: 'Map
> > Title: "Map"
> > File: %"Map.r"
> > Author: "Andrew Martin"
> > eMail: [Al--Bri--xtra--co--nz]
> > Date: 18/Oct/2001
> > Acknowledgements: [
> > "Joel Neely"
> > "Ladislav"
> > ]
> > Purpose: {Maps or applies the function to all elements of the
series.}
> > Example: [
> > Map func [n [number!]] [n * n] [1 2 3]
> > ;== [1 4 9]
> > Map [1 2 3] func [n [number!]] [n * n]
> > ;== [1 4 9]
> > Map [1 2 3 4 5 6] func [a] [print [a]]
> ...
>
> Hi Andrew,
>
> I find this solution a very interesting one. At least enough for my
current needs. I'll make en extensive study of it and may be
> I'll come back with comments if necessary.
>
> Thanks to all contributors for this great solution.
>
> Gerard
>
> --
> To unsubscribe from this list, please send an email to
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
>
-- Attached file included as plaintext by Listar --
-- File: Arguments.r
[
Rebol [
Name: 'Arguments
Title: "Arguments"
File: %"Arguments.r"
Author: "Andrew Martin"
eMail: [Al--Bri--xtra--co--nz]
Date: 22/Mar/2002
]
Arguments: function [
"Returns the arguments of the function."
F [any-function!]
] [
Arguments
] [
Arguments: make block! 2
foreach Argument pick :F 1 [
if refinement? :Argument [
break
]
append Arguments :Argument
]
Arguments
]
]