September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1 @@
[1, 1.1, [1,2], true, false, null, {"a":1}, null] | sort

View file

@ -0,0 +1 @@
[null,null,false,true,1,1.1,[1,2],{"a":1}]

View file

@ -0,0 +1,13 @@
def quicksort:
if length < 2 then . # it is already sorted
else .[0] as $pivot
| reduce .[] as $x
# state: [less, equal, greater]
( [ [], [], [] ]; # three empty arrays:
if $x < $pivot then .[0] += [$x] # add x to less
elif $x == $pivot then .[1] += [$x] # add x to equal
else .[2] += [$x] # add x to greater
end
)
| (.[0] | quicksort ) + .[1] + (.[2] | quicksort )
end ;