class LambdaAvailable in flash8, flash, neko, js, php, cpp, cs, java

The Lambda class is a collection of functional methods in order to use functional-style programming with Haxe.

Articles with more information on Lambda: The Great Lambda , map & filter , flash9 example

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 ) : IntCount the number of elements in an Iterable static function empty( it : Iterable<Dynamic> ) : BoolTells if an iterable does not contain any element. static function exists<A>( it : Iterable<A>, f : A -> Bool ) : BoolTells 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'
Usage Examples
static function fold<A, B>( it : Iterable<A>, f : A -> B -> B, first : B ) : BFunctional 'fold' using an Iterable
Usage Examples
static function foreach<A>( it : Iterable<A>, f : A -> Bool ) : BoolTells if all elements of the iterable have the specified property defined by f. If there is no element, returns true. static function has<A>( it : Iterable<A>, elt : A ) : BoolTells 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 ) : IntReturns 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 ) : VoidCall 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 List by applying the function 'f' to all elements of the iterable '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.
version #19311, modified 2013-05-08 11:13:32 by api
0 comment