Chouser, You're right that maybe-comp is simpler. Once you realize that the functions you want to compose are monadic functions under the maybe-m monad, you get that composition for 'free', with no further mental effort. With such a simple example, it's hard to see the benefit, but with more complicated monads the difference between the monad composition and ad-hoc style becomes greater. Where the ad-hoc version would have to be debugged, the monad version would already be proven to be correct.
Beyond that, there are other things that you get 'for free' by using the monad functions. Don't have time to enumerate them now but might later. Jim On Dec 22, 3:14 pm, Chouser <chou...@gmail.com> wrote: > > It's interesting to me that the definition of maybe-comp above is > arguably simpler that the definition of maybe-m, even without > counting the machinery of 'defmonad'. Presumably this is a hint > to how much more powerful maybe-m is than maybe-comp, and simply > shows I don't yet understand the power of monads. > > --Chouser > -- > -- I funded Clojure 2010, did you? http://clojure.org/funding -- 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