diff options
author | tv <tv@krebsco.de> | 2021-03-03 03:06:30 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2021-03-03 03:06:30 +0100 |
commit | 317b9549a217e552bf8aa314a6d6f46b532c6a8a (patch) | |
tree | a8940ed6055a6be9d5c025322fb640586a9526ef /lib | |
parent | 7e158f1c533de5ddc3a3cf77d360338c60ee3724 (diff) |
lib: add compose
Diffstat (limited to 'lib')
-rw-r--r-- | lib/default.nix | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/default.nix b/lib/default.nix index 2efeec078..4190f8f5f 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -15,6 +15,10 @@ let uri = import ./uri.nix { inherit lib; }; xml = import ./xml.nix { inherit lib; }; + # compose a list of functions to be applied from left to right, i.e. + # compose :: [ (xm -> xn) ... (x1 -> x2) (x0 -> x1) ] -> x0 -> xn + compose = foldl' (f: g: x: f (g x)) id; + eq = x: y: x == y; ne = x: y: x != y; mod = x: y: x - y * (x / y); |