implement std functions from nixpkgs.lib

This commit is contained in:
Emile Clark-Boman 2025-12-13 13:16:01 +10:00
parent f3b09cb54f
commit 9f5827c21c
3 changed files with 95 additions and 0 deletions

11
nib/std/lists.nix Normal file
View file

@ -0,0 +1,11 @@
rec {
foldl = op: nul: list: let
foldl' = n:
if n == -1
then nul
else op (foldl' (n - 1)) (builtins.elemAt list n);
in
foldl' (builtins.length list - 1);
crossLists = f: foldl (fs: args: builtins.concatMap (f: map f args) fs) [f];
}