about summary refs log tree commit diff
path: root/users/sterni/nix/num/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'users/sterni/nix/num/default.nix')
-rw-r--r--users/sterni/nix/num/default.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/users/sterni/nix/num/default.nix b/users/sterni/nix/num/default.nix
new file mode 100644
index 000000000000..640493083722
--- /dev/null
+++ b/users/sterni/nix/num/default.nix
@@ -0,0 +1,16 @@
+{ ... }:
+
+rec {
+  inherit (builtins)
+    mul
+    div
+    add
+    sub
+    ;
+
+  abs = i: if i < 0 then -i else i;
+
+  inRange = a: b: x: x >= a && x <= b;
+
+  sum = builtins.foldl' (a: b: a + b) 0;
+}