Prelude.filter
This commit is contained in:
@@ -70,7 +70,7 @@ class Kiss {
|
|||||||
"symbol" => Symbol("Prelude.symbol"),
|
"symbol" => Symbol("Prelude.symbol"),
|
||||||
"expList" => Symbol("Prelude.expList"),
|
"expList" => Symbol("Prelude.expList"),
|
||||||
"map" => Symbol("Lambda.map"),
|
"map" => Symbol("Lambda.map"),
|
||||||
"filter" => Symbol("Lambda.filter"), // TODO use truthy as the default filter function
|
"filter" => Symbol("Prelude.filter"),
|
||||||
"flatten" => Symbol("Lambda.flatten"),
|
"flatten" => Symbol("Lambda.flatten"),
|
||||||
"has" => Symbol("Lambda.has"),
|
"has" => Symbol("Lambda.has"),
|
||||||
"count" => Symbol("Lambda.count"),
|
"count" => Symbol("Lambda.count"),
|
||||||
|
@@ -517,4 +517,10 @@ class Prelude {
|
|||||||
throw "Can't run a subprocess on this target.";
|
throw "Can't run a subprocess on this target.";
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function filter<T>(l:Iterable<T>, ?p:(T) -> Bool):kiss.List<T> {
|
||||||
|
if (p == null)
|
||||||
|
p = Prelude.truthy;
|
||||||
|
return Lambda.filter(l, p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user