[Prev][Next][Index][Thread]
Currying in Dylan?
-
To: info-dylan@ai.mit.edu
-
Subject: Currying in Dylan?
-
From: Zeno <zenem@nospam.earthlink.net>
-
Date: Fri, 19 Jan 2001 15:15:02 -0500 (EST)
-
Abuse-Reports-To: abuse at airmail.net to report improper postings
-
Organization: Airnews.net! at Internet America
-
Xref: traf.lcs.mit.edu comp.lang.dylan:12997
I see in the Dylan White Paper at
http://functionalobjects.com/resources/white-paper.phtml that
functions are first class objects in Dylan and can be passed as
parameters.
I see that 'do' is like 'map' in other functional languages, 'choose'
is like 'filter', and that collections are similar to lists from the
following examples, in which 'windows' is a collection...
do(close, windows)
(closes all windows in the collection)
choose(even?, #(1, 2, 3, 4, 5, 6, 7, 8, 9));
=> #(2, 4, 6, 8)
What about 'foldr' and 'foldl'? Can one pass a function which takes
two parameters? i.e.,
foldr((+), 0, #(1, 2, 3));
=> 6
...or...
do( ((+), 1), #(1, 2, 3));
=> #(2, 3, 4)
Thank you,
- Zeno
Follow-Ups: