builtins redundant

This commit is contained in:
Emile Clark-Boman 2026-01-15 11:45:03 +10:00
parent 86711856c3
commit 1c53c2d749

View file

@ -16,11 +16,11 @@ in rec {
foldl' = n: foldl' = n:
if n == -1 if n == -1
then nul then nul
else op (foldl' (n - 1)) (builtins.elemAt list n); else op (foldl' (n - 1)) (elemAt list n);
in in
foldl' (builtins.length list - 1); foldl' (length list - 1);
crossLists = f: foldl (fs: args: builtins.concatMap (f: map f args) fs) [f]; crossLists = f: foldl (fs: args: concatMap (f: map f args) fs) [f];
findFirstIndex = pred: default: list: let findFirstIndex = pred: default: list: let
# A naive recursive implementation would be much simpler, but # A naive recursive implementation would be much simpler, but
@ -36,7 +36,7 @@ in rec {
# #
# We start with index -1 and the 0'th element of the list, which satisfies the invariant # We start with index -1 and the 0'th element of the list, which satisfies the invariant
resultIndex = resultIndex =
builtins.foldl' ( foldl' (
index: el: index: el:
if index < 0 if index < 0
then then
@ -63,10 +63,10 @@ in rec {
in in
if index == null if index == null
then default then default
else builtins.elemAt list index; else elemAt list index;
zipListsWith = f: 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)); genList (n: f (elemAt fst n) (elemAt snd n)) (min (length fst) (length snd));
# zipLists = zipListsWith (fst: snd: {inherit fst snd;}); # zipLists = zipListsWith (fst: snd: {inherit fst snd;});
} }