mirror of
https://github.com/NixOS/nix
synced 2025-07-08 19:23:54 +02:00
Add sort primop
This commit is contained in:
parent
50807f3dd5
commit
76cc8e97a2
4 changed files with 68 additions and 1 deletions
1
tests/lang/eval-okay-sort.exp
Normal file
1
tests/lang/eval-okay-sort.exp
Normal file
|
@ -0,0 +1 @@
|
|||
[ [ 42 77 147 249 483 526 ] [ 526 483 249 147 77 42 ] [ "bar" "fnord" "foo" "xyzzy" ] [ { key = 1; value = "foo"; } { key = 1; value = "fnord"; } { key = 2; value = "bar"; } ] ]
|
8
tests/lang/eval-okay-sort.nix
Normal file
8
tests/lang/eval-okay-sort.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
with builtins;
|
||||
|
||||
[ (sort lessThan [ 483 249 526 147 42 77 ])
|
||||
(sort (x: y: y < x) [ 483 249 526 147 42 77 ])
|
||||
(sort lessThan [ "foo" "bar" "xyzzy" "fnord" ])
|
||||
(sort (x: y: x.key < y.key)
|
||||
[ { key = 1; value = "foo"; } { key = 2; value = "bar"; } { key = 1; value = "fnord"; } ])
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue