mirror of
https://github.com/NixOS/nix
synced 2025-07-08 06:53:54 +02:00
* Generalised the dependencyClosure primop to builtins.genericClosure,
which is hopefully more useful. * New primops: length, mul, div.
This commit is contained in:
parent
d567baabbd
commit
7cd88b1dec
5 changed files with 442 additions and 139 deletions
13
tests/lang/eval-okay-closure.nix
Normal file
13
tests/lang/eval-okay-closure.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
let
|
||||
|
||||
closure = builtins.genericClosure {
|
||||
startSet = [{key = 80;}];
|
||||
operator = {key, foo ? false}:
|
||||
if builtins.lessThan key 0
|
||||
then []
|
||||
else [{key = builtins.sub key 9;} {key = builtins.sub key 13; foo = true;}];
|
||||
};
|
||||
|
||||
sort = (import ./lib.nix).sortBy (a: b: builtins.lessThan a.key b.key);
|
||||
|
||||
in sort closure
|
Loading…
Add table
Add a link
Reference in a new issue