[Prev][Next][Index][Thread]

Currying in Dylan?



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: