implement std functions from nixpkgs.lib
This commit is contained in:
parent
f3b09cb54f
commit
9f5827c21c
3 changed files with 95 additions and 0 deletions
11
nib/std/lists.nix
Normal file
11
nib/std/lists.nix
Normal 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];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue