Hello,
  I've never used monads but I have a problem that feels like it could
be solved elegantly with them.

 I have a sequence of functions of arbitary size and an input sequence
s. Each function is given a sequence and returns a sequence that can
be bigger than the input sequence. I want the output of one function
to be operated on using a mapcat of the next function:

    (let [seq-of-fns [f1 f2 f3 ... fm]]
         (mapcat fm ... (mapcat f2 (mapcat f1 s)))

If any of the functions return nil, I'd like the computation to stop.
This seems like something that should be possible with the maybe-m in
clojure.contrib.monad but I don't understand how to do the following:

1. How do I handle an arbitary seq-of-fns [f1 f2 ... fm]?
2. How can I specify that I want a function to mapcat the return value
of the previous function?

I've read the monad tutorials linked at 
http://richhickey.github.com/clojure-contrib/monads-api.html
which have been very useful but any extra help would be appreciated.

Thanks in advance
Saul


-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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