about summary refs log tree commit diff
path: root/users/sterni/nix/num/default.nix
blob: 81e2f8377f3b69aa3e78c3210c09f0bc3e029ca7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{ ... }:

rec {
  inherit (builtins)
    mul
    div
    add
    sub
    ;

  sign = i: if i < 0 then -1 else 1;
  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;
}