* Builtin function `add' to add integers.

* Put common test functions in tests/lang/lib.nix.
This commit is contained in:
Eelco Dolstra 2006-09-22 15:29:21 +00:00
parent d315210612
commit 2ab4bc44c7
11 changed files with 68 additions and 26 deletions

View file

@ -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);
}