Prev | Current Page 210 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


The Lambda class provides the list of methods as detailed Table 4 - 1 .
Chapter 4: Controlling the Flow of Information
97
Table 4.1
Lambda Method Description
array( it : Iterable ) : Array Creates Array from Iterator
count
( it : Iterable ) : Int Returns the number of elements in
Iterator

empty( it : Iterable ) : Bool Tells if an iterable does not contain any
element
exists
( it : Iterable,
f : A -> Bool ) : Bool
Tells if at least one element of the iterable is
found by using the specific function
filter
( it : Iterable,
f : A -> Bool ) : List

Returns the list of elements matching the
function f
fold( it : Iterable
,
f : A -> B -> B, first : B ) : B
Performs the functional ???fold??? on
Iterator

foreach
( it : Iterable,
f : A -> Bool ) : Bool
Tells if all elements of the iterable have the
specified property defined by f
has
( it : Iterable, elt : A,
?cmp : A -> A -> Bool ) : Bool
Tells if the element is part of an iterable
iter
( it : Iterable,
f : A -> Void ) : Void
Applies function (X -> T) to all elements of
Iterator

list
( it : Iterable ) : List Creates a List from Iterator
map( it : Iterable
,
f : A -> B ) : List
Creates an Iterator from Iterator

with function (X -> T) applied
mapi( it : Iterable
, f : Int ->
A -> B ) : List
Similar to map, but also passes an index for
each item iterated
map() And mapi()
The map and mapi methods of the Lambda class are very much like the map method of the List collection,
with the exception that Lambda.


Pages:
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222