indexes multimethod

Methods

indexes(e:Eachable1, pattern:Any=method) Source: stdlib.ngs:2788
Find all indexes of values that match the pattern

Parameters

patternTest function or anything else acceptable by (=~), defaults to Bool.constructors

Returns

Arr of Int

Example

[1,5,1,10].indexes(X>2)  # [1,3]
indexes(arr:Arr, r:PredRange, dflt:Any=block) Source: stdlib.ngs:2936
Find the indexes of elements of the given PredRange. Throws IndexNotFound if there is no match between the elements of arr and r.

Returns

NumRange with .include_start=true and .include_end=false

Example

%[a1 a2 b1 b2 c1].indexes(/^a/../^b/)   # <NumRange 1..2 include_start=true include_end=false step=1>
%[a1 a2 b1 b2 c1].indexes(/^a/.../^b/)  # <NumRange 0..3 include_start=true include_end=false step=1>