Advent-of-Nix-2024/utils.nix
2024-12-01 15:50:11 +01:00

10 lines
312 B
Nix

{ lib, ... }:
with lib;
with builtins; rec {
readLines = f: filter (s: (isString s) && s != "") (split "\n" (readFile f));
splitWhitespace = s: filter isString (builtins.split "[[:space:]]+" s);
abs = i: if i >= 0 then i else i * -1;
delta = x: y: abs (x - y);
noop = x: x;
listSum = foldl' add 0;
}