Order by pair comparisons: Difference between revisions
Content added Content deleted
(J) |
m (→{{header|J}}: make quicksort implementation be general (taking comparison function as an argument)) |
||
Line 917: | Line 917: | ||
if. 1 >: #y do. y |
if. 1 >: #y do. y |
||
else. |
else. |
||
(quicksort y |
(u quicksort y u sel e),(y =sel e),u quicksort y u~ sel e=.y{~?#y |
||
end. |
end. |
||
}} |
}} |
||
Line 927: | Line 927: | ||
}} |
}} |
||
askless=: {{ |
|||
coord=. x ,&(items&i.) y |
coord=. x ,&(items&i.) y |
||
lt=. LT {~<coord |
lt=. LT {~<coord |
||
Line 940: | Line 940: | ||
items=: ~.y |
items=: ~.y |
||
LT=: <:%=i.#items |
LT=: <:%=i.#items |
||
quicksort y |
askless quicksort y |
||
}}</lang> |
}}</lang> |
||