Types
Eachable which each() calls the callback with one argument
- Eachable
-
Parent type of all types that have each() method
- Arr
-
Array - list of items accessed by zero-based index
- ArrIter
-
Arr (array) iterator.
- ArrLike
-
Parent type for user-defined types with array-like behaviour. Use in cases when you would like to inherit from built-in Arr. Inheriting from built-ins is not possible for now.
- ConstIter
-
Iterator that returns given value forever.
- Int
-
Integer type. On 64 bit platforms it's a 61 bit signed integer
- NumRange
- RangeIter
-
NOT IMPLEMENTED YET. Iterator that returns values in the given range
- ResDef
- Str
-
String type
- Table
-
Manipulates tabular data
Methods
any(e:Eachable1, predicate:Any)
Check whether there is any element in arr that satisfies the given predicate.
TODO: Make it work on anything with Eachable2 too.
filter(something:Eachable1, predicate:Any)
Filter something to an Arr (array) of values using predicate.
filter(something:Eachable1)
Filter nulls out.
DEPRECATED, USE something.without(null) INSTEAD.
first(e:Eachable1, predicate:Any)
Find first element in e that satisfies the predicate.
first(e:Eachable1)
Find first element in e that satisfies Bool(e) == true.
Exactly same as first(e, identity).
get(e:Eachable1, attr:Str)
Return array made of given attribute of each element of given Eachable1 where present
get(e:Eachable1, attr:Str, dflt:Any)
Return array made of given attribute of each element of given Eachable1 where present or default value where the attribute is not present
Return array (? depends on map() ?) made of given attribute of each element of given Eachable1
none(e:Eachable1, predicate:Fun)
Check that there is no element in e that satisfies the given predicate. Exactly same as not(any(e, predicate)) .
reduce(something:Eachable1, start:Any, f:Fun)
Combine items to a single value using the supplied binary function
First f is applied to start and the first element of something
then on each step f is applied to previous result and next element
of something.
the_one(something:Eachable1, predicate:Any)
Find the only element that satisfies the predicate.
Throws TheOneFail exception if there are no elements that satisfy the predicate or if there is more than one element that satisfies the predicate.
the_one(something:Eachable1, predicate:Any, body:Fun, found_more:Fun=(a function), found_none:Fun=(a function))
Find the only element that satisfies the predicate and execute given code with the value
the_one(something:Eachable1)
Extract the only element.
Throws TheOneFail exception if there are no elements or if there is more than one element.