add zipLists & zipListsWith
This commit is contained in:
parent
5126482fb4
commit
d4af51803f
1 changed files with 10 additions and 2 deletions
|
|
@ -1,4 +1,9 @@
|
||||||
{...}: rec {
|
{nib, ...}: let
|
||||||
|
inherit
|
||||||
|
(nib.std)
|
||||||
|
min
|
||||||
|
;
|
||||||
|
in rec {
|
||||||
foldl = op: nul: list: let
|
foldl = op: nul: list: let
|
||||||
foldl' = n:
|
foldl' = n:
|
||||||
if n == -1
|
if n == -1
|
||||||
|
|
@ -52,5 +57,8 @@
|
||||||
then default
|
then default
|
||||||
else builtins.elemAt list index;
|
else builtins.elemAt list index;
|
||||||
|
|
||||||
zipLists = zipListsWith (fst: snd: {inherit fst snd;});
|
zipListsWith = f: fst: snd:
|
||||||
|
builtins.genList (n: f (builtins.elemAt fst n) (builtins.elemAt snd n)) (min (builtins.length fst) (builtins.length snd));
|
||||||
|
|
||||||
|
# zipLists = zipListsWith (fst: snd: {inherit fst snd;});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue