Examples of Code in Roman
All these expressions are examples of the simple grammar of Roman expressions. (Please read that post for better understanding these examples)
Define x to be equal to 4.
x = 4 .
: x
x 2 +
: 6
x 5 +
: 9
Query if 3 is greather than 2.
3 > 2 ?
: True
query if 4 is equal to 2.
4 = 2 ?
: False
Define square
, a function that multiplies a number with itself
using anoymous function
square = (x => (x x *) fn) .
: square
add10 = (x => (x 10 +) fn) .
Apply square
to 4
.
4 square
: 16
2 add10
: 12
(4 square) add10
: 26
(4 add10) square
: 196
(3 square) square
: 81