retroforth/example/sort-on-stack.forth
crc 881d81f492 new example
FossilOrigin-Name: d3a4d01e151c86e306b9dff8b18148d977ef108de8cedfb8848a055ccf2bb28d
2017-10-17 20:28:43 +00:00

10 lines
187 B
Forth

~~~
:sort-pair dup-pair lt? [ swap ] if ;
:perform-sort sort-pair depth #2 gt? [ [ perform-sort ] dip ] if ;
:sort depth [ perform-sort ] times ;
~~~
~~~
#3 #33 #22 #333 #5 sort
~~~