add zipLists & zipListsWith

This commit is contained in:
Emile Clark-Boman 2025-12-18 11:54:26 +10:00
parent 5126482fb4
commit d4af51803f

View file

@ -1,4 +1,9 @@
{...}: rec {
{nib, ...}: let
inherit
(nib.std)
min
;
in rec {
foldl = op: nul: list: let
foldl' = n:
if n == -1
@ -52,5 +57,8 @@
then default
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;});
}