Jump to content

Run-length encoding: Difference between revisions

→‎{{header|jq}}: ensure runs/0 works with jq 1.4 and later
m (→‎{{header|jq}}: correct typo)
(→‎{{header|jq}}: ensure runs/0 works with jq 1.4 and later)
Line 1,830:
( [];
if . == [] then [ [ $item, 1] ]
else .[length-1] as $last
| if $last[0] == $item then (.[0:length-1] + [= [$item, $last[1] + 1] ] )
else . + [[$item, 1]]
end
2,497

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.