From: "Wolfgang Nádasi-Donner" Date: 2008-02-16T22:18:32+09:00 Subject: Re: Proc#curry Yukihiro Matsumoto schrieb: > proc {|x, y, z| x + y + z }.curry > > returns the proc object equivalent to > > proc {|x| proc {|y| proc {|z| x + y + z } } } This is what I would expect from "currying" (or sch��nfinkeln). So I would expect, that the calls will be... proc {|x, y, z| x + y + z }[1,2,3] proc {|x, y, z| x + y + z }.curry[1][2][3] ...with the same result, but that... proc {|x, y, z| x + y + z }.curry[1,2,3] would fail with the message "3 parameters instead of 1". I'm a little bit surprized, that ist works... boviMacBook:~ bovi$ ruby19 --version ruby 1.9.0 (2008-02-16 revision 0) [i686-darwin9.1.0] boviMacBook:~ bovi$ irb19 irb(main):001:0> f = proc{|a,b,c|a+b+c} => # irb(main):002:0> g = f.curry => # irb(main):003:0> f[1,2,3] => 6 irb(main):004:0> g[1][2][3] => 6 irb(main):005:0> def otto(fun) irb(main):006:1> fun[3,4] irb(main):007:1> end => nil irb(main):008:0> r = proc{|k,l|k*l} => # irb(main):009:0> s = proc{|m,n,o|m+n+o}.curry => # irb(main):010:0> otto(r) => 12 irb(main):011:0> otto(s[2]) => 9 Is this an accident or done by intention. If it is done by intention it is nice, because otherwise I must implement an application which uses currying with currying all Proc objects that use more than one parameter. Wolfgang N��dasi-Donner