53
Creates a new [Iterator] that will apply the function 'f' to all
53
Creates a new [Iterable] by appling the function 'f' to all
54
54
elements of the iterator 'it'.
56
public static function map<A,B>( it : Iterator<A>, f : A -> B ) : Iterator<B> {
59
next : function() { return f(it.next()); }
56
public static function map<A,B>( it : Iterable<A>, f : A -> B ) : List<B> {
57
var l = new List<B>();
64
Similar to [map], but also pass an index for each item iterated.
66
public static function mapi<A,B>( it : Iterable<A>, f : Int -> A -> B ) : List<B> {
67
var l = new List<B>();
75
Tells if the element is part of an iterable
77
public static function has<A>( it : Iterable<A>, elt : A, ?cmp : A -> A -> Bool ) : Bool {
64
Call the function 'f' on all elements of the [Iterator] 'it'.
66
public static function iter<A>( it : Iterator<A>, f : A -> Void ) {
91
Tells if at least one element of the iterable if found by using the specific function.
93
public static function exists<A>( it : Iterable<A>, f : A -> Bool ) {
101
Tells if all elements of the iterable have the specified property defined by [f].
103
public static function foreach<A>( it : Iterable<A>, f : A -> Bool ) {
111
Call the function 'f' on all elements of the [Iterable] 'it'.
113
public static function iter<A>( it : Iterable<A>, f : A -> Void ) {
72
Creates an [Array] from an [Array] 'a' by applying the function 'f'
73
on all elements of 'a'.
119
Return the list of elements matching the function 'f'
75
public static function amap<A,B>(a : Array<A>,f : A -> B) : Array<B> {
121
public static function filter<A>( it : Iterable<A>, f : A -> Bool ) {
122
var l = new List<A>();
83
Functional 'fold' using an [Iterator]
130
Functional 'fold' using an [Iterable]
85
public static function fold<A,B>( it : Iterator<A>, f : A -> B -> B, first : B ) : B {
132
public static function fold<A,B>( it : Iterable<A>, f : A -> B -> B, first : B ) : B {
87
134
first = f(x,first);
92
Count the number of elements in an [Iterator]
139
Count the number of elements in an [Iterable]
94
public static function count<A>( it : Iterator<A> ) {
141
public static function count<A>( it : Iterable<A> ) {
b'\\ No newline at end of file'
149
Tells if an iterable does not contain any element.
151
public static function empty( it : Iterable<Dynamic> ) : Bool {
152
return !it.iterator().hasNext();