Eachable type

Parent type of all types that have each() method

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:1702
Check whether all elements in arr satisfy the given predicate.

Parameters

eThe items to check
predicateTest function

Returns

Bool

Example

[1,2,3].all(X<10)   # true
[1,2,10].all(X>5)   # false
map(e:Eachable, mapper:Fun) Source: stdlib.ngs:279
Map e to an Arr (array) of values using mapper.

Parameters

eObject of any type that has each(e, callback) implemented

Returns

Arr

Example

[1,2,3].map(X*4)  # [4,8,12]
reject(something:Eachable, predicate:Any) Source: stdlib.ngs:478
Filter something to an Arr (array) of values using predicate

Parameters

somethingobject of any type that has each(something, callback) implemented
predicateDecision 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

Arr

Example

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