Add 'find_indices'

This commit is contained in:
Danila Fedorin 2020-12-07 22:46:36 -08:00
parent 6fc6c5cf53
commit 15e94c0286

View File

@ -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)