From: David Flanagan Date: 2007-06-06T13:37:41+09:00 Subject: Re: currying in Ruby Thanks for your response, Victor. Could you clarify about currying and instance_eval? What is the "usual problem" The >> and << are (obviously) and experimental syntax. I like that it specifies whether the argument being curried goes on the left hand side (>>) or the right hand side (<<) of the argument list. I gather that true functional programming fans like currying to happen automatically if you invoke a function with too few arguments. So I was looking for a compact syntax, akin to invocation, for currying. I don't have a way to curry arguments in the middle of the list, but I suspect that this is not, in practice, that big a problem. I would argue that the overhead of allowing arbitrary "holes" as the rubymurray implementation does is too great, and that when you need to do this you'd be better off just writing your own custom proc wrapper to do what you need. My complaints with rubymurray are: 1) its overkill--just too long 2) it bothers me that currying a Proc returns a Curry object rather than a Proc object. And that the resulting Curry object is not itself Curryable. David Victor "Zverok" Shepelev wrote: > From: David Flanagan [mailto:david@davidflanagan.com] > Sent: Wednesday, June 06, 2007 3:35 AM >> I've written a little argument currying module for Procs and Methods. I >> think my only real contribution here is the use of << and >> operators >> as a shorthand, which I haven't seen done elsewhere. >> >> Anyone care to review the code and comment? > > * The usual problem with proc currying: instance_eval (and instance_exec in > Ruby 1.9 and Facets imitation). > > * Personally I dislike >> and << syntax. What this should read like? "shift > difference to 10"? And what about currying of "middle" parameters? > > * What's wrong with existing currying module[1]? It's syntax is a bit more > verbose, but reads more natural, I think (especially if alias HOLE and > BLACKHOLE with shorter constants). > > V. > > 1. http://rubymurray.rubyforge.org/ > >