| |
|
| :noname false :noname ; |
:noname false :noname ; |
| :noname locals-wordlist last @ lastcfa @ |
:noname locals-wordlist last @ lastcfa @ |
| postpone SCOPE postpone AHEAD true :noname ; |
postpone AHEAD |
| interpret/compile: [: |
locals-list @ locals-list off |
| |
locals-dp @ dup >r postpone SCOPE |
| |
true :noname r> locals-dp ! ; |
| |
interpret/compile: [: ( -- quotation-sys ) |
| |
\G Starts a quotation |
| |
|
| : ;] ( compile-time: orig colon-sys -- ; run-time: -- xt ) |
: ;] ( compile-time: quotation-sys -- ; run-time: -- xt ) |
| |
\g ends a quotation |
| POSTPONE ; >r IF |
POSTPONE ; >r IF |
| ] postpone THEN r> postpone ALiteral postpone ENDSCOPE |
] postpone ENDSCOPE |
| |
locals-dp ! locals-list ! |
| |
postpone THEN |
| lastcfa ! last ! to locals-wordlist |
lastcfa ! last ! to locals-wordlist |
| |
r> postpone ALiteral |
| ELSE r> THEN ( xt ) ; immediate |
ELSE r> THEN ( xt ) ; immediate |
| |
|
| \\\ |
0 [IF] \ tests |
| : if-else ( ... f xt1 xt2 -- ... ) |
: if-else ( ... f xt1 xt2 -- ... ) |
| \ Postscript-style if-else |
\ Postscript-style if-else |
| rot IF |
rot IF |
| |
|
| 1 test cr \ writes "true" |
1 test cr \ writes "true" |
| 0 test cr \ writes "false" |
0 test cr \ writes "false" |
| |
|
| |
\ locals within quotations |
| |
|
| |
: foo { a b } a b |
| |
[: { x y } x y + ;] execute . a . b . ; |
| |
2 3 foo |
| |
[THEN] |