On Feb 16, 6:06 am, Trans <transf... / gmail.com> wrote:
> Yep. I see.
>
> It is rather trivial, I agree. Unfortunately maybe too trivial because
> were stuck with the order of arguments. Or doe curry take some
> argument to vary that? To clarify what I mean, Facets has an
> implementation of curry, for both Proc and Method, like so:
>
>   proc {|x, y, z| x + y + z }.curry(__,__,__)
>
> Of course I like your better in this case ;-)  BUT, it does allow:
>
>   proc {|x, y, z| x + y + z }.curry(__,5,__)
>
> for:
>
>   proc {|x| proc {|z| x + 5 + z } }
>
> T.

You might want to have a look at gem ludy for Proc#bind,
http://ludy.rubyforge.org/classes/Proc.html#M000042

I'd written Proc#curry as well, so you can write as following:

godfat ~> irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'ludy/proc'
=> true
irb(main):003:0> lambda{|x,y,z|[x,y,z]}.curry.bind(:_1, 2, :_2)[1,3]
=> [1, 2, 3]

I am glad to see Proc#curry can be added into core, not supporting
with library,
but I didn't see there's Proc#uncurry as well. I hope there's one too.

Functional programming matters. :)