Good catch with currying non vars; I'll try to work something out. Also, should come up with a general defcurry macro; I'm not happy with that. Things like foldM may just not be possible, but I'll keep track of these issues so maybe I can give you a good answer for the things you've brought up. Just having to deal with deftype'd monoids is a bit of a pain, so I welcome ideas to simplify them.
On Wednesday, February 6, 2013 4:43:33 PM UTC-8, Ben wrote: > > this is great, just one nit to pick about currying (because it's > something that's bitten me in the past in other contexts): > > in the wiki you say "For a predefined function with a fixed number of > arguments, only the function name must be supplied.", but this is only > sort of true---the issue isn't whether the function is predefined or > not, the issue is whether the argument is a symbol that resolves to a > var. This, for instance, doesn't work: > > (let [t take] (((curry t) 3) '(1 2 3 4))) > > Even though "take" is a predefined function. And this picks up the > wrong metadata (this example is factitious on its face, but it could > happen in practice): > > blancas.morph.core> (defn three-params [a b c] a) > #'blancas.morph.core/three-params > blancas.morph.core> (let [three-params take] (((curry three-params) 3) > '(1 2 3 4))) > #<core$eval2780$G__2784__2785$G__2786__2787$fn__2788 > blancas.morph.core$eval2780 > $G__2784__2785$G__2786__2787$fn__2788@65c66812> > blancas.morph.core> > > because "resolve" goes directly to var bindings, overlooking other > niceties of lexical scope. > > Unrelatedly: > > - I couldn't figure out how to write something like foldM, because I > couldn't figure out how to call return on the seed value when the list > is empty. ISTR (when you announced your parsing library) that there > isn't a way to do that kind of thing at all? > - I'm curious about the Monoid protocol---I have one in babbage, and > it has two more methods than yours, "mempty?" and "value" (instead of > monoid-specific accessors). Why not put the accessors in the protocol? > > On Wed, Feb 6, 2013 at 4:06 PM, Armando Blancas > <abm2...@gmail.com<javascript:>> > wrote: > > Morph is a new implementation of monads based on protocols. It's > intended to > > provide the common patterns of error-handling, short-circuit sequencing, > and > > modeling of stateful computations in pure functions. I've tried to make > this > > library idiomatic while keeping it close to its Haskell roots. > > > > This is a utility library that, I hope, can make your coding easier. No > > particular knowledge is assumed or required. The docs name things but > rely > > on getting an intuitive feeling of what's going on. Protocols are > relevant > > only if you want to write your own plumbing, which shouldn't be > difficult; > > otherwise it's all ready to use. > > > > Project: https://github.com/blancas/morph > > User Guide: https://github.com/blancas/morph/wiki > > Codox API: http://blancas.github.com/morph > > > > Please use the project wiki for feedback, bug reports, or feature > requests. > > > > -- > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clo...@googlegroups.com<javascript:> > > Note that posts from new members are moderated - please be patient with > your > > first post. > > To unsubscribe from this group, send email to > > clojure+u...@googlegroups.com <javascript:> > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > > --- > > You received this message because you are subscribed to the Google > Groups > > "Clojure" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to clojure+u...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > > -- > Ben Wolfson > "Human kind has used its intelligence to vary the flavour of drinks, > which may be sweet, aromatic, fermented or spirit-based. ... Family > and social life also offer numerous other occasions to consume drinks > for pleasure." [Larousse, "Drink" entry] > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.