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