Created
January 2, 2010 01:24
-
-
Save lsparrish/267334 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) | |
( do ... until ) | |
( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) | |
( Value n is taken from the stack and stored to a virtual ) | |
( variable. When this number is equal to the TOS at the time ) | |
( until is executed, the loop terminates. ) | |
( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) | |
{{ | |
: skipped-nop ( - ) 8 , here 2 + , 0 , ; | |
: virtual-var ( R: -a C: -aa ) | |
here dup 1- | |
dup literal, ; | |
---reveal--- | |
: target ( R: -n C: aa-aa ) | |
dup , ` @ ; | |
: do ( R: nn-n? C: -aa ) | |
` 2dup ` >if | |
skipped-nop | |
virtual-var ` ! ; compile-only | |
: until ( R: ?n- C: aa- ) | |
` dup literal, ` @ | |
` > ` if swap 8 , 3 + , | |
` then ` drop | |
` else ` 2drop ` then ; compile-only | |
}} | |
: test 10 11 do dup . 1- until ; | |
test | |
: test 10 10 do dup . 1- until ; | |
test | |
: test 10 1 do dup . 1- until ; | |
test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment