diff options
Diffstat (limited to 'tests/lang/eval-okay-arithmetic.nix')
-rw-r--r-- | tests/lang/eval-okay-arithmetic.nix | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/lang/eval-okay-arithmetic.nix b/tests/lang/eval-okay-arithmetic.nix new file mode 100644 index 000000000000..735f01cf4e69 --- /dev/null +++ b/tests/lang/eval-okay-arithmetic.nix @@ -0,0 +1,18 @@ +with import ./lib.nix; + +let { + + range = first: last: [first] ++ (if first == last then [] else range (builtins.add first 1) last); + + /* Supposedly tail recursive version: + + range_ = accum: first: last: + if first == last then ([first] ++ accum) + else range_ ([first] ++ accum) (builtins.add first 1) last; + + range = range_ []; + */ + + body = sum (range 1 50); + +} |