As I understand it, m-seq is transforms a list of monadic computation
into a computation returning the list of result.
The resulting computation just sequentially does every computationin
the sequence and keep the result.

It is useful when the arity is not known at runtime foir example.


On Tue, Nov 2, 2010 at 10:45 AM, Sunil S Nandihalli
<sunil.nandiha...@gmail.com> wrote:
> 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 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



-- 
Sent from an IBM Model M, 15 August 1989.

-- 
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