add skip/2 as the counterpart to limit/2 (#3181)
I also changed the behavior of limit/2 with negative count to emit an error, like nth/2 does. Also, I redefined nth/2 using skip/2 to minimize the impact of growth of builtin filters.
This commit is contained in:
1 parent
860af44fee
commit
1bebd23aad
5 files changed
+70
-13
No files matched your search
Generated
+5
-1
@@ -873,10 +873,14 @@ isempty(.[])
|
||||
[1,2,3]
|
||||
false
|
||||
|
||||
[limit(3;.[])]
|
||||
[limit(3; .[])]
|
||||
[0,1,2,3,4,5,6,7,8,9]
|
||||
[0,1,2]
|
||||
|
||||
[skip(3; .[])]
|
||||
[0,1,2,3,4,5,6,7,8,9]
|
||||
[3,4,5,6,7,8,9]
|
||||
|
||||
[first(range(.)), last(range(.)), nth(./2; range(.))]
|
||||
10
|
||||
[0,9,5]
|
||||
|
||||
Reference in new issue
Block a user