feat(tvix/eval): implement builtins.partition
Change-Id: I8b591f3057c68c1542046fc5a771973f2238c9df Reviewed-on: https://cl.tvl.fyi/c/depot/+/7020 Autosubmit: j4m3s <james.landrein@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
4dcb8f38c2
commit
5ee2258692
3 changed files with 39 additions and 0 deletions
|
@ -0,0 +1 @@
|
|||
[ { right = [ 1 2 3 4 5 ]; wrong = [ ]; } { right = [ ]; wrong = [ 1 2 3 4 5 ]; } { right = [ 2 ]; wrong = [ 1 3 4 5 ]; } { right = [ [ 1 2 ] [ 3 4 ] ]; wrong = [ [ 1 ] [ 2 ] [ 3 ] ]; } ]
|
|
@ -0,0 +1,13 @@
|
|||
[
|
||||
(builtins.partition (_: true) [ 1 2 3 4 5])
|
||||
(builtins.partition (_: false) [ 1 2 3 4 5])
|
||||
(builtins.partition (x: x == 2) [ 1 2 3 4 5])
|
||||
|
||||
(builtins.partition (x: (builtins.length x) > 1) [
|
||||
[ 1 ]
|
||||
[ 1 2 ]
|
||||
[ 2 ]
|
||||
[ 3 ]
|
||||
[ 3 4 ]
|
||||
])
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue