On 18.01.2009, at 20:55, DavidH wrote:

> The gist is that a function is applied to each member of a sequence,
> like map, except that the function also takes a changing state.  The
> change to the state is described by a second function.

You might want to look at the state monad, defined in  
clojure.contrib.monads. It is an abstraction for the composition of  
computations that work on changeable state. Each computation has the  
form

        (fn [old-state] (list result new-state))

The state monad provides various functions to combine such  
computations. Depending on the exact nature of your functions, you  
may want to look at m-map, m-seq, or m-chain for your mapping problem.

For an example of how the state monad can be used, see:

        http://clojure.googlegroups.com/web/monads.clj

Konrad.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to