diff --git a/example/sort-on-stack.forth b/example/sort-on-stack.forth new file mode 100644 index 0000000..4ce55cc --- /dev/null +++ b/example/sort-on-stack.forth @@ -0,0 +1,10 @@ +~~~ +: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 +~~~ +