47件ヒット
[1-47件を表示]
(0.018秒)
種類
- インスタンスメソッド (33)
- 文書 (14)
ライブラリ
- ビルトイン (33)
クラス
- Proc (33)
キーワード
-
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 3
. 0 . 0 (4) - curry (22)
検索結果
先頭5件
-
Proc
# arity -> Integer (39213.0) -
Proc オブジェクトが受け付ける引数の数を返します。
...
Proc オブジェクトが受け付ける引数の数を返します。
ただし、可変長引数を受け付ける場合、負の整数
-(必要とされる引数の数 + 1)
を返します。
//emlist[例][ruby]{
lambda{ }.arity # => 0
lambda{|| }.arity # => 0
lambd......a{|x| }.arity # => 1
lambda{|*x| }.arity # => -1
lambda{|x, y| }.arity # => 2
lambda{|x, *y| }.arity # => -2
lambda{|(x, y)| }.arity # => 1
lambda{|(x, y), z|}.arity # => 2
//}... -
Proc
# curry(arity) -> Proc (21279.0) -
Procをカリー化します
...Procをカリー化します
カリー化したProcはいくつかの引数をとります。十分な数の引数が与えられると、元のProcに引数を渡し
て実行し、結果を返します。引数の個数が足りないときは、部分適用したカリー化Procを返します......。
@param arity 引数の個数を指定します
@return カリー化したProcオブジェクトを返します
//emlist[例][ruby]{
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
p b.curry(5)[1][2][3][4][5] #=> 6
p b.curry(......)[1] #=> 1
b = proc {|x, y, z, *w| (x||0) + (y||0) + (z||0) + w.sum }
p b.curry[1][2][3] #=> 6
p b.curry[1, 2][3, 4] #=> 10
p b.curry(5)[1][2][3][4][5] #=> 15
p b.curry(5)[1, 2][3, 4][5] #=> 15
p b.curry(1)[1] #=> 1
b = lambda {|x, y, z| (x||0) + (y||0)... -
Proc
# curry -> Proc (21179.0) -
Procをカリー化します
...Procをカリー化します
カリー化したProcはいくつかの引数をとります。十分な数の引数が与えられると、元のProcに引数を渡し
て実行し、結果を返します。引数の個数が足りないときは、部分適用したカリー化Procを返します......。
@param arity 引数の個数を指定します
@return カリー化したProcオブジェクトを返します
//emlist[例][ruby]{
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
p b.curry(5)[1][2][3][4][5] #=> 6
p b.curry(......)[1] #=> 1
b = proc {|x, y, z, *w| (x||0) + (y||0) + (z||0) + w.sum }
p b.curry[1][2][3] #=> 6
p b.curry[1, 2][3, 4] #=> 10
p b.curry(5)[1][2][3][4][5] #=> 15
p b.curry(5)[1, 2][3, 4][5] #=> 15
p b.curry(1)[1] #=> 1
b = lambda {|x, y, z| (x||0) + (y||0)... -
NEWS for Ruby 3
. 0 . 0 (66.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ror or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166
//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}
pr.call([1])......* Kernel#eval when called with two arguments will use `"(eval)"` for `__FILE__` and `1` for `__LINE__` in the evaluated code. 4352
* Kernel#lambda now warns if called without a literal block. 15973
* Kernel.sleep invokes the scheduler hook `#kernel_sleep(...)` in a non-blocking execution......* EXPERIMENTAL: Hash#each consistently yields a 2-element array. 12706
* Now `{ a: 1 }.each(&->(k, v) { })` raises an ArgumentError due to lambda's arity check.
* When writing to STDOUT redirected to a closed pipe, no broken pipe error message will be shown now. 14413
* `TRUE`/`FALSE`/`NIL... -
NEWS for Ruby 2
. 2 . 0 (42.0) -
NEWS for Ruby 2.2.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...entError ではなく
ArgumentError のサブクラスである UncaughtThrowError を発生させるようになりました
* Process
* 拡張: Process.spawn のような外部プロセスを起動するメソッドは [:out, :err] からリダイレクト
されたファイル......m, String#intern によって返される多くのシンボルがGC可能になりました
* Method
* 追加: Method#curry([arity]) はカリー化された Proc オブジェクトを返します
* 追加: Method#super_method はスーパクラスの同名のメソッドの Method オブ......を返します。
* Proc
* 非互換: ArgumentError は発生しなくなりました。
* ArgumentError is no longer raised when lambda Proc is passed as a
block, and the number of yielded arguments does not match the formal
arguments of the lambda, if just an array is yield...