Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
templates pancakeSort
|
||||
@: {stack: $, flips: 0"1"};
|
||||
sink flip
|
||||
when <2..> do
|
||||
@pancakeSort.stack(1..$): $@pancakeSort.stack($..1:-1)...;
|
||||
'$@pancakeSort.stack;$#10;' -> !OUT::write
|
||||
@pancakeSort.flips: $@pancakeSort.flips + 1"1";
|
||||
end flip
|
||||
sink fixTop
|
||||
@: 1;
|
||||
2..$ -> #
|
||||
$ -> \(when <~=$@fixTop> do $@fixTop -> !flip $ -> !flip \) -> !VOID
|
||||
when <?($@pancakeSort.stack($) <$@pancakeSort.stack($@)..>)> do @: $;
|
||||
end fixTop
|
||||
$::length..2:-1 -> !fixTop
|
||||
$@ !
|
||||
end pancakeSort
|
||||
|
||||
[6,7,2,1,8,9,5,3,4] -> pancakeSort -> !OUT::write
|
||||
Loading…
Add table
Add a link
Reference in a new issue