Guest User

Untitled

a guest
May 17th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. value index :a # store `value' in array linked to top of stack `a', with index `index'
  2. index ;a # push a[index] on (main) stack
  3.  
  4. [z 1- :a z 0 !=F]dsFx # or I could just write such a function for you :)
  5.  
  6. [ # Everything is wrapped in one big macro
  7. [ # An inner macro for our *then* part
  8. # <-- Stuff to execute if a==b here
  9. 2Q # Then quit the inner and outer macro
  10. ]sE # `E' is for Execution register ;)
  11. la lb =E # if a==b, execute E
  12. # if E is executed, it will quit the whole macro, so the rest is never reached:
  13. # <-- Stuff to execute if a!=b here
  14. ]x # End macro; Execute
  15.  
  16. [[(then)2Q]sE(condition)E(else)]x
  17.  
  18. A == B ? C : D;
  19.  
  20. 0AB-^E*C+
  21.  
  22. _3 # pushes -3
  23.  
  24. _ # pushes 0...sometimes
  25.  
  26. c4 5_6 # -6,5,4
  27. c4 5_ 6 # -6,5,4
  28. c4 5_
  29. 6 # -6,5,4 # still a negative sign since the next thing it sees is a digit
  30. c4 5_z # 3,0,4,5 # if it's followed by a non-digit, it's a 0
  31. c4 5_p6 # 6,0,5,4
  32. c4 _* # 0 # 4*0=0
Add Comment
Please, Sign In to add comment