Add 'find_indices'
This commit is contained in:
@@ -33,6 +33,14 @@ class Array(T)
|
|||||||
puts
|
puts
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def find_indices
|
||||||
|
into = [] of T
|
||||||
|
each_with_index do |v, i|
|
||||||
|
into << i if yield v
|
||||||
|
end
|
||||||
|
into
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
struct Tuple(*T)
|
struct Tuple(*T)
|
||||||
|
|||||||
Reference in New Issue
Block a user