More work on Ref doc, & stuff.

This commit is contained in:
sforman
2023-10-08 17:58:22 -07:00
parent d833f1a3e9
commit eb665f2b50
8 changed files with 119 additions and 13 deletions
+16
View File
@@ -0,0 +1,16 @@
<div class="discussion"><p>This works by building a little [while] program and running it:
1 3 [++] • [-- dip] cons [swap] infra [0 &gt;] swap while pop <br>
1 3 [++] [-- dip] • cons [swap] infra [0 &gt;] swap while pop <br>
1 3 [[++] -- dip] • [swap] infra [0 &gt;] swap while pop <br>
1 3 [[++] -- dip] [swap] • infra [0 &gt;] swap while pop
dip -- [++] • swap [3 1] swaack [0 &gt;] swap while pop <br>
dip [++] -- • [3 1] swaack [0 &gt;] swap while pop <br>
dip [++] -- [3 1] • swaack [0 &gt;] swap while pop <br>
1 3 [-- [++] dip] • [0 &gt;] swap while pop <br>
1 3 [-- [++] dip] [0 &gt;] • swap while pop
1 3 [0 &gt;] [-- [++] dip] • while pop
This is a common pattern in Joy. You accept some parameters from the
stack which typically include qouted programs and use them to build
another program which does the actual work. This is kind of like macros
in Lisp, or preprocessor directives in C.</p></div>