On 02.12.2008, at 18:49, jim wrote:

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

That's actually pretty close to what I had at some point, except that  
I didn't know about the possibility to provide a default value to  
get, which is indeed nice. What made me prefer my somewhat longer  
version is that I dislike code repetition. I wanted to have the (map # 
(replace-syms sym-map %) expr) only once, hence the need for an  
additional let.

> There's a quick explanation of monads at the beginning of the file.

And a pretty good one, without the frequent mystification of the topic!

> File is at:
>
> http://groups.google.com/group/clojure/web/monad-redux.clj

That's another interesting way to implement monads. What I dislike  
about both of our approaches is that the monad macro machinery has to  
know about all operations that use the monad definition. I'll keep  
searching for monad heaven ;-)

Konrad.


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

Reply via email to