indexes multimethod

Methods

indexes(e:Eachable1, predicate:Any) Source: stdlib.ngs:1936
Find all indexes of values that satisfy the predicate

Parameters

predicateTest function

Returns

Arr of Int

Example

[1,5,1,10].indexes(X>2)  # [1,3]
indexes(arr:Arr, r:PredRange, dflt:Any=[]) Source: stdlib.ngs:2067
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>