JortSort: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
|||
Line 248: | Line 248: | ||
} |
} |
||
</lang> |
</lang> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|C++}}== |
=={{header|C++}}== |
||
Line 322: | Line 347: | ||
2 1 3 4 5 : -> The array is not sorted! |
2 1 3 4 5 : -> The array is not sorted! |
||
</pre> |
</pre> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Clojure}}== |
=={{header|Clojure}}== |
||
Line 691: | Line 691: | ||
true |
true |
||
true</pre> |
true</pre> |
||
=={{header|Mathematica}}== |
=={{header|Mathematica}}== |
||
Line 763: | Line 762: | ||
The task wants us to sort, but we could implement this by just using <tt>cmp</tt> on the input array elements, which would be faster (especially with unsorted input). |
The task wants us to sort, but we could implement this by just using <tt>cmp</tt> on the input array elements, which would be faster (especially with unsorted input). |
||
⚫ | |||
⚫ | |||
⚫ | Actually, there's a better internal sort that seems to work best for lists that are already completely sorted, but tends to fails for any other list. The name of this sort, <tt>[!after]</tt>, is completely opaque, so we're pretty much forced to hide it inside a subroutine to prevent widespread panic. |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
<lang Phix>type JortSort(sequence s) |
<lang Phix>type JortSort(sequence s) |
||
Line 872: | Line 859: | ||
(for/and ([x (in-list l)] [y (in-list (cdr l))]) |
(for/and ([x (in-list l)] [y (in-list (cdr l))]) |
||
(not (<? y x))))) ; same as (<= x y) but using only <?</lang> |
(not (<? y x))))) ; same as (<= x y) but using only <?</lang> |
||
⚫ | |||
(formerly Perl 6) |
|||
⚫ | |||
⚫ | Actually, there's a better internal sort that seems to work best for lists that are already completely sorted, but tends to fails for any other list. The name of this sort, <tt>[!after]</tt>, is completely opaque, so we're pretty much forced to hide it inside a subroutine to prevent widespread panic. |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|REXX}}== |
=={{header|REXX}}== |