A couple of weeks ago, I took a crack at figuring out monads by implementing them in Clojure. Inspired by Konrad's work, I pulled that out and completed it.
I had chosen to implement a monad as a hash-map which is then passed in to the standard monadic operations as an additional parameter. Lifting 'with-monad' and 'domonad' from Konrad's file, I implemented versions using that idea. One thing I saw is that 'replace-syms' could be simplified. I rewrote it as: (defn- replace-syms [sym-map expr] (cond (seq? expr) (map #(replace-syms sym-map %) expr) (coll? expr) (into (empty expr) (map #(replace-syms sym-map %) expr)) :else (get sym-map expr expr))) And then I changed it further to accommodate my needs. I also changed 'monad-expr' to be a single call to 'reduce'. There's a quick explanation of monads at the beginning of the file. Thanks to Konrad for posting some good code. File is at: http://groups.google.com/group/clojure/web/monad-redux.clj Jim --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---