2017-10-20 22:34:18 +02:00
|
|
|
# RETRO Quick Reference
|
|
|
|
|
|
|
|
Displaying Things
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
Numbers
|
|
|
|
=======
|
|
|
|
|
2018-05-07 18:39:49 +02:00
|
|
|
#100 n:put
|
2017-10-20 22:34:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
Characters
|
|
|
|
==========
|
|
|
|
|
2018-05-07 18:39:49 +02:00
|
|
|
$a c:put
|
2017-10-20 22:34:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
Strings
|
|
|
|
=======
|
|
|
|
|
2018-05-07 18:39:49 +02:00
|
|
|
'hello,_world s:put
|
2017-10-20 22:34:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
Mixed
|
|
|
|
=====
|
|
|
|
|
2018-05-07 18:39:49 +02:00
|
|
|
#1 #2 #3 '%n_-_%n_=_%n\n s:format s:put
|
|
|
|
'Charles' 'Hello_%s\n s:format s:put
|
2017-10-20 22:34:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
Conditionals
|
|
|
|
------------
|
|
|
|
|
|
|
|
Equality
|
|
|
|
========
|
|
|
|
|
|
|
|
|
|
|
|
#2 #3 eq?
|
|
|
|
|
|
|
|
|
|
|
|
Inequality
|
|
|
|
==========
|
|
|
|
|
|
|
|
#3 #4 -eq?
|
|
|
|
|
|
|
|
|
|
|
|
Greather Than
|
|
|
|
=============
|
|
|
|
|
|
|
|
#3 #4 gt?
|
|
|
|
|
|
|
|
|
|
|
|
Less Than
|
|
|
|
=========
|
|
|
|
|
|
|
|
#3 #4 lt?
|
|
|
|
|
|
|
|
|
|
|
|
Greater Than or Equal To
|
|
|
|
========================
|
|
|
|
|
|
|
|
#3 #4 gteq?
|
|
|
|
|
|
|
|
|
|
|
|
Less Than or Equal To
|
|
|
|
=====================
|
|
|
|
|
|
|
|
#3 #4 lteq?
|
|
|
|
|
|
|
|
|
|
|
|
String Equality
|
|
|
|
===============
|
|
|
|
|
|
|
|
'hello 'world s:eq?
|
|
|
|
|
|
|
|
|
|
|
|
String Inequality
|
|
|
|
=================
|
|
|
|
|
|
|
|
'hello 'world s:eq? not
|
|
|
|
|
|
|
|
|
|
|
|
If / Then
|
|
|
|
=========
|
|
|
|
|
|
|
|
#1 #2 eq? [ 'true ] [ 'false ] choose
|
|
|
|
#1 #2 eq? [ 'true ] if
|
|
|
|
#1 #2 eq? [ 'false ] -if
|
|
|
|
|
|
|
|
|
|
|
|
Multiple Comparisons
|
|
|
|
====================
|
|
|
|
|
|
|
|
[ @Base
|
|
|
|
#8 [ 'octal ] case
|
|
|
|
#10 [ 'decimal ] case
|
|
|
|
#16 [ 'hexadecimal ] case
|
|
|
|
drop (default_case)
|
|
|
|
] call
|
|
|
|
|
|
|
|
|
|
|
|
Function Defintions
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
Quotes (Anonymous)
|
|
|
|
==================
|
|
|
|
|
|
|
|
[ (code) ]
|
|
|
|
|
|
|
|
Quotes can be nested.
|
|
|
|
|
|
|
|
|
|
|
|
Named
|
|
|
|
=====
|
|
|
|
|
|
|
|
:name (stack_comment)
|
|
|
|
(code) ;
|
|
|
|
|
|
|
|
Quotes can be nested inside a named function.
|
|
|
|
|
|
|
|
|
|
|
|
Loops
|
|
|
|
-----
|
|
|
|
|
|
|
|
Unconditional
|
|
|
|
=============
|
|
|
|
|
|
|
|
repeat (code) again
|
|
|
|
|
|
|
|
Conditional loops are generally preferable.
|
|
|
|
|
|
|
|
|
|
|
|
Counted
|
|
|
|
=======
|
|
|
|
|
|
|
|
(simple,_no_index_on_stack)
|
2018-05-07 18:39:49 +02:00
|
|
|
#10 [ $a c:put ] times
|
2017-10-20 22:34:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
Conditional
|
|
|
|
===========
|
|
|
|
|
2018-05-07 18:39:49 +02:00
|
|
|
#10 [ n:dec dup n:put dup n:-zero? ] while
|
2017-10-20 22:34:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
Math
|
|
|
|
----
|
|
|
|
|
|
|
|
Addition
|
|
|
|
========
|
|
|
|
|
|
|
|
#100 #200 +
|
|
|
|
|
|
|
|
|
|
|
|
Subtraction
|
|
|
|
===========
|
|
|
|
|
|
|
|
#400 #32 -
|
|
|
|
|
|
|
|
|
|
|
|
Multiplication
|
|
|
|
==============
|
|
|
|
|
|
|
|
#98 #12 *
|
|
|
|
|
|
|
|
|
|
|
|
Division
|
|
|
|
========
|
|
|
|
|
|
|
|
#200 #4 /
|
|
|
|
|
|
|
|
|
|
|
|
Remainder
|
|
|
|
=========
|
|
|
|
|
|
|
|
#203 #4 mod
|
|
|
|
|
|
|
|
|
|
|
|
Power
|
|
|
|
=====
|
|
|
|
|
|
|
|
Raise 3 to the second power.
|
|
|
|
|
|
|
|
#3 #2 n:pow
|
|
|
|
|
|
|
|
|
|
|
|
Absolute Value
|
|
|
|
==============
|
|
|
|
|
|
|
|
#-76 n:abs
|
|
|
|
|
|
|
|
|
|
|
|
Minimum and Maximum Value
|
|
|
|
=========================
|
|
|
|
|
|
|
|
#34 #8 n:min
|
|
|
|
#34 #8 n:max
|