haXe API Documentation
Back | Index
class Lambda
Available in flash, neko, js, flash9, php, cpp
The Lambda class is a collection of functional methods in order to use functional-style programming with haXe.
static function array<A>(it : Iterable<A>) : Array<A>
Creates an Array from an Iterable
static function concat<T>(a : Iterable<T>, b : Iterable<T>) : List<T>
Returns a list containing all items of 'a' followed by all items of 'b'
static function count<A>(it : Iterable<A>, ?pred : A -> Bool) : Int
Count the number of elements in an Iterable having pred returning true.
static function empty(it : Iterable<Dynamic>) : Bool
Tells if an iterable does not contain any element.
static function exists<A>(it : Iterable<A>, f : A -> Bool) : Bool
Tells if at least one element of the iterable is found by using the specific function.
static function filter<A>(it : Iterable<A>, f : A -> Bool) : List<A>
Return the list of elements matching the function 'f'
static function fold<A, B>(it : Iterable<A>, f : A -> B -> B, first : B) : B
Functional 'fold' using an Iterable
static function foreach<A>(it : Iterable<A>, f : A -> Bool) : Bool
Tells if all elements of the iterable have the specified property defined by f.
static function has<A>(it : Iterable<A>, elt : A, ?cmp : A -> A -> Bool) : Bool
Tells if the element is part of an iterable. The comparison is made using the == operator. Optionally you can pass as a third parameter a function that performs the comparison. That function must take as arguments the two items to compare and returns a boolean value.
static function indexOf<T>(it : Iterable<T>, v : T) : Int
Returns the index of the item in the given Iterable, depending on the order of the Iterator. Returns -1 if the item was not found.
static function iter<A>(it : Iterable<A>, f : A -> Void) : Void
Call the function 'f' on all elements of the Iterable 'it'.
static function list<A>(it : Iterable<A>) : List<A>
Creates a List from an Iterable
static function map<A, B>(it : Iterable<A>, f : A -> B) : List<B>
Creates a new Iterable by appling the function 'f' to all elements of the iterator 'it'.
static function mapi<A, B>(it : Iterable<A>, f : Int -> A -> B) : List<B>
Similar to map, but also pass an index for each item iterated.
Back | Index