diff --git a/util.nix b/util.nix index 0e35c09..831b26c 100644 --- a/util.nix +++ b/util.nix @@ -20,10 +20,7 @@ let [(take cnt l)] ++ chunksOf cnt (drop cnt l) else []; # same as intersectLists but takes an array of lists to intersect instead of just two - intersectManyLists = l: - if length l == 0 then [] - else if length l == 1 then head l - else intersectLists (head l) (intersectManyLists (tail l)); + intersectManyLists = ll: foldr intersectLists (head ll) ll; # converts a boolean to a int (c style) boolToInt = b: if b then 1 else 0; # drops the last element of a list