From d4af51803f5036a8c4d508d3075335a0f5e62e05 Mon Sep 17 00:00:00 2001 From: Emile Clark-Boman Date: Thu, 18 Dec 2025 11:54:26 +1000 Subject: [PATCH] add zipLists & zipListsWith --- nib/std/lists.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nib/std/lists.nix b/nib/std/lists.nix index 868bc3e..54ff919 100644 --- a/nib/std/lists.nix +++ b/nib/std/lists.nix @@ -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;}); }