Prelude.filter
This commit is contained in:
@@ -70,7 +70,7 @@ class Kiss {
|
||||
"symbol" => Symbol("Prelude.symbol"),
|
||||
"expList" => Symbol("Prelude.expList"),
|
||||
"map" => Symbol("Lambda.map"),
|
||||
"filter" => Symbol("Lambda.filter"), // TODO use truthy as the default filter function
|
||||
"filter" => Symbol("Prelude.filter"),
|
||||
"flatten" => Symbol("Lambda.flatten"),
|
||||
"has" => Symbol("Lambda.has"),
|
||||
"count" => Symbol("Lambda.count"),
|
||||
|
||||
@@ -517,4 +517,10 @@ class Prelude {
|
||||
throw "Can't run a subprocess on this target.";
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
(method :Array<String> queryImageUrls [:Array<String> imageTitles]
|
||||
(flatten
|
||||
(for =>_id image (the haxe.DynamicAccess<Dynamic> .pages .query (query [=>"titles" imageTitles =>"prop" ["imageinfo"] =>"iiprop" ["url"]]))
|
||||
(image.imageinfo.map ->image image.url))))
|
||||
(if image.imageinfo
|
||||
(image.imageinfo.map ->image image.url)
|
||||
[]))))
|
||||
|
||||
(var headers [=>"User-Agent" "NatArchiveTool/0.0.0 (https://github.com/NQNStudios/kisslang/tree/main/projects/nat-archive-tool; natquaylenelson@gmail.com) Requests/2.26.0"])
|
||||
Reference in New Issue
Block a user