Hello everybody,
I was looking at the functions/macros defined with them I find that m-lift
is very easy and intuitive ..
following is the extract from the monads example ...
(with-monad sequence-m
(defn pairs [xs]
((m-lift 4 #(list :a %1 :b %2 :c %3 :d %4))
(range 0 3)
(range 10 13)
(range 100 103)
(range 1000 1003))))
(pairs (range 2))
; Another way to define pairs is through the m-seq operation. It takes
; a sequence of monadic values and returns a monadic value containing
; the sequence of the underlying values, obtained from chaining together
; from left to right the monadic values in the sequence.
(with-monad sequence-m
(defn pairs [xs]
(m-seq (list xs xs))))
can somebody help me understand what is happening in the second one .. ?
when would it be more appropriate to use m-seq instead of m-lift ..
Thanks,
Sunil.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en