Konrad,
Here's an updated state-m monad transformer. I dropped my CA in the
mail today. I figure if I post a snippet of code to the list, it's
public domain, so do with it as you wish. Or wait till Rich gets my
CA.
(defn state-t [m]
(monad [m-result (with-monad m
(fn [v]
(fn [s]
(m-result (list v s)))))
m-bind (with-monad m
(fn [stm f]
(fn [s]
(m-bind (stm s)
(fn [[v ss]]
((f v) ss))))))
m-zero (with-monad m
(if (not= ::undefined m-zero)
::undefined
(fn [s]
m-zero)))
m-plus (with-monad m
(if (= ::undefined m-plus)
::undefined
(fn [& stms]
(fn [s]
(apply m-plus
(map #(% s) stms))))))
]))
Jim
On Feb 18, 2:24 am, Konrad Hinsen <[email protected]> wrote:
> The latest Clojure version broke many of my code by introducing the
> function sequence whose name collided with my sequence monad. So I
> decided that since now is the time for breaking changes, I should
> solve that kind of problem thoroughly. I just renamed all monads in
> clojure.contrib.monads and clojure.contrib.probabilities, the names
> now have a -m suffix: sequence-m, maybe-m, etc.
>
> Konrad.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---