From 881d81f4928cda7869416e7a46f1c8e08a917d7d Mon Sep 17 00:00:00 2001 From: crc Date: Tue, 17 Oct 2017 20:28:43 +0000 Subject: [PATCH] new example FossilOrigin-Name: d3a4d01e151c86e306b9dff8b18148d977ef108de8cedfb8848a055ccf2bb28d --- example/sort-on-stack.forth | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 example/sort-on-stack.forth 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 +~~~ +