385件ヒット
[101-200件を表示]
(0.050秒)
クラス
- Array (121)
-
Encoding
:: Converter (11) - Mutex (2)
- Object (33)
- StopIteration (11)
- String (132)
-
Thread
:: Mutex (9)
モジュール
- Enumerable (66)
キーワード
- === (11)
- [] (66)
-
_ dump (11) - combination (22)
- fetch (33)
- inject (33)
-
marshal
_ dump (11) - permutation (22)
-
primitive
_ errinfo (11) - reduce (33)
-
repeated
_ combination (22) -
repeated
_ permutation (22) - slice (66)
- synchronize (11)
検索結果
先頭5件
-
Array
# combination(n) {|c| block } -> self (21.0) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...た配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # => [1,2,3,4]
result #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
//}
@see Array#permutation, Array#repeated_combination... -
Array
# permutation(n = self . length) -> Enumerator (21.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.permutation(2) {|e| result << e} # => [1,2,3]
result # => [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
//}
@see Array#combination, Array#repeated_permutation... -
Array
# permutation(n = self . length) { |p| block } -> self (21.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.permutation(2) {|e| result << e} # => [1,2,3]
result # => [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
//}
@see Array#combination, Array#repeated_permutation... -
Array
# repeated _ combination(n) -> Enumerator (21.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.repeated_combination(3) {|e| result << e} # => [1,2,3]
result #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
//}
@see... -
Array
# repeated _ combination(n) { |c| . . . } -> self (21.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.repeated_combination(3) {|e| result << e} # => [1,2,3]
result #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
//}
@see... -
Array
# repeated _ permutation(n) -> Enumerator (21.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}
@see Array#repeated_com... -
Array
# repeated _ permutation(n) { |p| . . . } -> self (21.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}
@see Array#repeated_com... -
String
# [](substr) -> String | nil (21.0) -
self が substr を含む場合、一致した文字列を新しく作って返します。 substr を含まなければ nil を返します。
...た文字列を新しく作って返します。
substr を含まなければ nil を返します。
@param substr 取得したい文字列のパターン。文字列
//emlist[例][ruby]{
substr = "bar"
result = "foobar"[substr]
p result # => "bar"
p substr.equal?(result) # => false
//}... -
String
# slice(substr) -> String | nil (21.0) -
self が substr を含む場合、一致した文字列を新しく作って返します。 substr を含まなければ nil を返します。
...た文字列を新しく作って返します。
substr を含まなければ nil を返します。
@param substr 取得したい文字列のパターン。文字列
//emlist[例][ruby]{
substr = "bar"
result = "foobar"[substr]
p result # => "bar"
p substr.equal?(result) # => false
//}... -
Array
# fetch(nth) -> object (15.0) -
nth 番目の要素を返します。
...しなかった場合に発生します。
//emlist[例][ruby]{
a = [1, 2, 3, 4, 5]
begin
p a.fetch(10)
rescue IndexError => err
puts err #=> index 10 out of array
end
p a.fetch(10, 999) #=> 999
result = a.fetch(10){|nth|
print "#{nth} はありません。\n"
999
}
p result #=> 999
//}...