Guest User

Untitled

a guest
Apr 27th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. ( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
  2. ( do ... until )
  3. ( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
  4. ( Value n is taken from the stack and stored to a virtual )
  5. ( variable. When this number is equal to the TOS at the time )
  6. ( until is executed, the loop terminates. )
  7. ( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
  8.  
  9. {{
  10. : skipped-nop ( - ) 8 , here 2 + , 0 , ;
  11. : virtual-var ( R: -a C: -aa )
  12. here dup 1-
  13. dup literal, ;
  14. ---reveal---
  15. : target ( R: -n C: aa-aa )
  16. dup , ` @ ;
  17.  
  18. : do ( R: nn-n? C: -aa )
  19. ` 2dup ` >if
  20. skipped-nop
  21. virtual-var ` ! ; compile-only
  22. : until ( R: ?n- C: aa- )
  23. ` dup literal, ` @
  24. ` > ` if swap 8 , 3 + ,
  25. ` then ` drop
  26. ` else ` 2drop ` then ; compile-only
  27. }}
  28. : test 10 11 do dup . 1- until ;
  29. test
  30. : test 10 10 do dup . 1- until ;
  31. test
  32. : test 10 1 do dup . 1- until ;
  33. test
Add Comment
Please, Sign In to add comment