Advertisement
TheFastFish

Elon for

Apr 25th, 2016
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. $
  2. Besides lists, Elon has
  3. no real control structures.
  4. This creates a Symbol which
  5. runs a BASIC style for.
  6. ITERATIVE ONLY.
  7. STACK ARGS:
  8. -step count
  9. -end index
  10. -start index
  11. -routine list
  12. $
  13. {
  14. $ claim args $
  15. "c-step" define
  16. "c-end" define
  17. "c-start" define
  18. "routine" define
  19.  
  20. c-start "counter" define
  21. set
  22. routine
  23. counter c-step add "counter" define
  24. counter c-end less { repeat } do
  25. forget
  26.  
  27. "c-step" undefine
  28. "c-end" undefine
  29. "c-start" undefine
  30. "routine" undefine
  31. "counter" undefine
  32. } "for" define
  33.  
  34. $ example usage $
  35. {
  36. counter print
  37. } 0 10 1 for
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement