Merge pull request #68 from jfmengels/list-concat-map-replacement

Add List concatMap replacement
This commit is contained in:
Matthew Griffith 2022-02-06 12:12:45 -05:00 committed by GitHub
commit 8ce60a3357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,18 @@
var $elm$core$List$concatMap = F2(function (f, lists) {
if (!lists.b) {
return _List_Nil;
}
var tmp = _List_Cons(undefined, _List_Nil);
var end = tmp;
for (; lists.b.b; lists = lists.b) {
var xs = f(lists.a);
for (; xs.b; xs = xs.b) {
var next = _List_Cons(xs.a, _List_Nil);
end.b = next;
end = next;
}
}
end.b = f(lists.a);
return tmp.b;
});