JortSort: Difference between revisions
Content added Content deleted
m (→{{header|J}}) |
|||
Line 1,114: | Line 1,114: | ||
It does that because at the lowest level a cmp imm is at least twice as fast as a cmp [mem], and the only other way it could know these constants at compile-time would be to (re)build a 5000-node ternary tree, though I will concede that any sane person would have written a program to write an include file rather than hacking these things by hand.<br> |
It does that because at the lowest level a cmp imm is at least twice as fast as a cmp [mem], and the only other way it could know these constants at compile-time would be to (re)build a 5000-node ternary tree, though I will concede that any sane person would have written a program to write an include file rather than hacking these things by hand.<br> |
||
There is a similar thing in pwa\src\p2js_keywords.e, though it automatically checks, prompts, and auto-rebuilds that for you. |
There is a similar thing in pwa\src\p2js_keywords.e, though it automatically checks, prompts, and auto-rebuilds that for you. |
||
=={{header|Picat}}== |
|||
<lang Picat>go => |
|||
List = [ |
|||
[1,2,3,4,5], |
|||
[2,3,4,5,1], |
|||
[2], |
|||
"jortsort", |
|||
"jortsort".sort() |
|||
], |
|||
foreach(L in List) |
|||
printf("%w: ", L), |
|||
if not jortsort(L) then |
|||
print("not ") |
|||
end, |
|||
println("sorted") |
|||
end, |
|||
nl. |
|||
jortsort(X) => X == X.sort().</lang> |
|||
Output: |
|||
<pre>[1,2,3,4,5]: sorted |
|||
[2,3,4,5,1]: not sorted |
|||
[2]: sorted |
|||
jortsort: not sorted |
|||
joorrstt: sorted</pre> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |