るりまサーチ

最速Rubyリファレンスマニュアル検索!
50件ヒット [1-50件を表示] (0.015秒)
トップページ > クエリ:Array[x] > クエリ:product[x]

別のキーワード

  1. array fill
  2. array sample
  3. array []
  4. array count
  5. array rindex

ライブラリ

クラス

検索結果

Array#product(*lists) -> Array (39239.0)

レシーバの配列と引数で与えられた配列(複数可)のそれぞれから要素を1 個ずつとって配列とし,それらのすべての配列を要素とする配列を返します。

...][ruby]{
[1,2,3].product([4,5]) # => [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]
[1,2].product([1,2]) # => [[1,1],[1,2],[2,1],[2,2]]
[1,2].product([3,4],[5,6]) # => [[1,3,5],[1,3,6],[1,4,5],[1,4,6],
# [2,3,5],[2,3,6],[2,4,5],[2,4,6]]
[1,2].product() # =>...
...[[1],[2]]
[1,2].product([]) # => []
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = []
[1,2,3].product([4,5]) {|e| a << e} # => [1,2,3]
a # => [[1,4],[1,5],[2,4],[2,5]...

Array#product(*lists) { |e| ... } -> self (39139.0)

レシーバの配列と引数で与えられた配列(複数可)のそれぞれから要素を1 個ずつとって配列とし,それらのすべての配列を要素とする配列を返します。

...][ruby]{
[1,2,3].product([4,5]) # => [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]
[1,2].product([1,2]) # => [[1,1],[1,2],[2,1],[2,2]]
[1,2].product([3,4],[5,6]) # => [[1,3,5],[1,3,6],[1,4,5],[1,4,6],
# [2,3,5],[2,3,6],[2,4,5],[2,4,6]]
[1,2].product() # =>...
...[[1],[2]]
[1,2].product([]) # => []
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = []
[1,2,3].product([4,5]) {|e| a << e} # => [1,2,3]
a # => [[1,4],[1,5],[2,4],[2,5]...

NEWS for Ruby 2.5.0 (30.0)

NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...to_s 呼び出しにも refinements が影響するようになりました 13812

=== 組み込みクラスの更新

* Array
* Array#append を追加 12746
* Array#prepend を追加 12746

* Data
* 非推奨になりました。C拡張のベースクラスでしたが、Rubyレベ...
...のソースコードを表示します 14124

* matrix
* Matrix.combine, Matrix#combine を追加 10903
* Matrix#hadamard_product, Matrix#entrywise_product を追加

* net/http
* Net::HTTP.new が no_proxy パラメータをサポートしました 11195
* Net::HTTP#min_version...

NEWS for Ruby 2.1.0 (24.0)

NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...よるメソッド定義式は nil の代わりにメソッド名をシンボルで返します

=== 組み込みクラスの更新

* Array
* 追加: Array#to_h キーと値のペアの配列をハッシュに変換します。

* Binding
* 追加: Binding#local_variable_get
* 追...
...ときは string-scrub gem を使います。

* Symbol
* 全てのシンボルは freeze されるようになりました

* pack/unpack (Array/String)
* プラットフォームが対応していれば Q! と q! は long long 型を表します

* toplevel
* main.using はもは...
...t::Class.file コンストラクタのためにオプショナル引数を取れるようになりました

* matrix
* 追加: Vector#cross_product

* net/smtp
* 追加: Net::SMTP#rset RSET コマンドに対応している

* objspace
* 追加: ObjectSpace.#trace_object_allocatio...

NEWS for Ruby 2.2.0 (12.0)

NEWS for Ruby 2.2.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...hen 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 yielded and its length
matches.

* Process
* Process.spawn のようなプロセスを起動するようなメソッドは [:out, :...
...* 追加: Matrix#laplace_expansion
* 追加: Vector.basis
* 追加: Vector#-@, Vector#+@, Matrix#-@, Matrix#+@
* 追加: Vector#cross_product
* 追加: Vector#dot
* 追加: Vector#angle_with
* 追加: Vector.independent?, Vector#independent?

* pathname
* Pathname#/...

絞り込み条件を変える