From: "Victor \"Zverok\" Shepelev" Date: 2007-06-06T13:51:42+09:00 Subject: Re: currying in Ruby From: David Flanagan [mailto:david@davidflanagan.com] Sent: Wednesday, June 06, 2007 7:38 AM > >Thanks for your response, Victor. BTW, I've noticed we are at ruby-core. I think, it's offtopic here. Maybe we should go to ruby-talk? >Could you clarify about currying and instance_eval? What is the "usual >problem" class A def method(x); puts x end end test = lambda{|x| method(x)} test1 = test << 7 A.new.instance_eval &test1 This shouldn't work, unfortunately. >My complaints with rubymurray are: > >1) its overkill--just too long As i've mentioned, it can be shortened to: my_proc.curry(H, 7) #with H standing for HOLE or something especially strange, like my_proc.curry($__, 7) Shorter, but cryptic a bit. Though, looking at this line only, I can suppos, what's happening here (even if i don't know about library used, but know about general "currying" concept). IMHO, your variant (my_proc >> 7) is unreadable. Sorry. Though, there was only one case in my practice, when I've really need carrying (and still can't use ruby-murray because of instance_eval). No other cases can remember. OK, but if only currying can be "always here", and "look pretty", may'be I'd use it more regularly. >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. Yeah, it's a real flaw! V