diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-07-28 17:27:32 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-07-28 17:28:35 +0200 |
commit | 50807f3dd5241667dac0c0cc302042d648de4b42 (patch) | |
tree | 3f6222262e66b64c2dc7479f618e2beb78faca9a /tests | |
parent | f3dda728a4a92520ec9db7bd28a184af9c07db0d (diff) |
Add primop genList
This can be used to implement functions like ‘imap’ (or for that
matter, ‘map’) without the quadratic complexity incurred by calling
‘++’ repeatedly.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lang/lib.nix | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/lang/lib.nix b/tests/lang/lib.nix index 262cdd7e8..028a53831 100644 --- a/tests/lang/lib.nix +++ b/tests/lang/lib.nix @@ -54,8 +54,8 @@ rec { const = x: y: x; range = first: last: - if builtins.lessThan last first - then [] - else [first] ++ range (builtins.add first 1) last; + if first > last + then [] + else genList (n: first + n) (last - first + 1); } |