Open
Description
I am very happy to see how the development of jq
is being revived. I will take advantage to insist on my particular feature request: an efficient implementation for drop
and rest
builtins. The prototypes I copy at the end are semantically correct, but extremely inefficient!
Thanks and encouragement!
def drop($n; g):
select($n >= 0) | # not defined for n < 0 or n >= #g
if $n == 0
then g
else
foreach g as $item ($n; .-1; # . will never reach -(infinity), I hope!
if . < 0 then $item else empty end)
end
;
def rest(g):
foreach g as $item (1; .-1; # . will never reach -(infinity), I hope!
if . < 0 then $item else empty end)
;