Eachable type
Direct children types
- Eachable1
Eachable which each() calls the callback with one argument Direct subtypes: 16
- Eachable2
Eachable which each() calls the callback with two arguments Direct subtypes: 2
Methods
- all(e:Eachable, predicate:Any) Source: stdlib.ngs:1565
Check whether all elements in arr satisfy the given predicate. Parameters
e The items to check predicate Test function Returns
BoolExample
[1,2,3].all(X<10) # true [1,2,10].all(X>5) # false
- map(e:Eachable, mapper:Fun) Source: stdlib.ngs:257
Map e to an Arr (array) of values using mapper. Parameters
e Object of any type that has each(e, callback) implemented Returns
ArrExample
[1,2,3].map(X*4) # [4,8,12]
- reject(something:Eachable, predicate:Any) Source: stdlib.ngs:456
Filter something to an Arr (array) of values using predicate Parameters
something object of any type that has each(something, callback) implemented predicate Decision function to be called with each item as first argument. When predicate(item) returns true, the item will not appear in the resulting array Returns
ArrExample
(1...10).reject(F(num) num % 2 == 0) # Gives [1,3,5,7,9] (1...10).reject(X<5) # Gives [5,6,7,8,9,10], predicate called as predicate(item, 5)