Evaluation of a numeral:
Value: 10
–
Prefix notation allows to pass a slew of arguments:
Value: 12
–
A simple combination applying an operator to two operands:
Value: 8
–
Value: 3
–
Nested combinations are also allowed by the prefix notation:
Value: 6
–
define is a special form that does not follow the read-eval-print loop (REPL):
Value: a
–
Value: b
–
Value: 19
–
= is a primitive predicate. A predicate evaluates to either to the constant #f or the constant #t:
Value: #f
–
if is a special form also:
1 2 3
| (if (and (> b a) (< b (* a b)))
b
a) |
Value: 4
–
cond is a conditional expression used in case analysis:
1 2 3
| (cond ((= a 4) 6)
((= b 4) (+ 6 7 a))
(else 25)) |
Value: 16
--
Value: 6
--
1 2 3 4
| (* (cond ((> a b) a)
((< a b) b)
(else -1))
(+ a 1)) |
Value: 16