2ab4bc44c7
* Put common test functions in tests/lang/lib.nix.
19 lines
375 B
Nix
19 lines
375 B
Nix
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);
|
|
|
|
}
|