ruby-changes:71457
From: Jeremy <ko1@a...>
Date: Fri, 18 Mar 2022 12:36:42 +0900 (JST)
Subject: [ruby-changes:71457] 634e0a97eb (master): Encourage arity argument in Proc#curry documentation for procs with variable arguments
https://git.ruby-lang.org/ruby.git/commit/?id=634e0a97eb From 634e0a97eb82ab259c7f7a35d0486baebe77df0f Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Thu, 17 Mar 2022 20:34:13 -0700 Subject: Encourage arity argument in Proc#curry documentation for procs with variable arguments This uses similar language to that used in Method#curry. --- proc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/proc.c b/proc.c index 4a4ba70c87..faf3a5166e 100644 --- a/proc.c +++ b/proc.c @@ -3569,6 +3569,10 @@ curry(RB_BLOCK_CALL_FUNC_ARGLIST(_, args)) https://github.com/ruby/ruby/blob/trunk/proc.c#L3569 * proc and returns the result. Otherwise, returns another curried proc that * takes the rest of arguments. * + * The optional <i>arity</i> argument should be supplied when currying procs with + * variable arguments to determine how many arguments are needed before the proc is + * called. + * * b = proc {|x, y, z| (x||0) + (y||0) + (z||0) } * p b.curry[1][2][3] #=> 6 * p b.curry[1, 2][3, 4] #=> 6 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/