Quick Reference
See the Humus language overview for more detail.
- Define Variable(s)
DEF pattern AS expression
- Define Function
DEF name(pattern) AS expression
- Create Actor
CREATE name WITH behavior
- Send Message
SEND message TO actor
- Update Behavior
BECOME behavior
- Abort Message-Event Transaction
THROW expression
- Execute Statement Block
- expression
- Constant
TRUE, FALSE, NIL, or ?
- (Integer) Number
- [
-]digits* or radix#digits*
- Symbol
#name
- This Actor
SELF
- New Actor
NEW behavior
- Pairing and Grouping
1, 2, 3 is equivalent to (1, (2, 3)), and () is NIL
- (Lambda) Abstraction
\pattern.expression
- (Function) Application
abstraction(expression)
- Conditional
CASE value OF pattern : expression ... END
- Statement Block
[ statement... ]
- Literal
TRUE, FALSE, NIL, ?, number, or symbol
- This Actor
SELF
- Variable
- name or
_ to ignore
- Tuple
- pattern
, pattern ...
- Value
$name or $(expression)
println
- An actor that receives any message, and prints it to the console
timer
- An actor that receives
(dt, msg, actor),
and sends msg to actor after dt milliseconds
random
- An actor that receives
(cust, n),
and sends cust a random number from 0 to n-1
eq(value, value)
- Value equality produces a boolean
not(boolean)
and(boolean, boolean)
or(boolean, boolean)
- Boolean predicates produce a boolean or
?
is_boolean(value)
is_number(value)
is_function(value)
is_actor(value)
is_pair(value)
- Type predicates produce a boolean
neg(number)
add(number, number)
sub(number, number)
mul(number, number)
div(number, number)
mod(number, number)
- Arithmetic operations produce a number or
?
compare(number, number)
- Numeric comparison produces
-1 if <, 0 if =, 1 if >, or ?
less(number, number)
less_equal(number, number)
greater_equal(number, number)
greater(number, number)
- Numeric predicates produce a boolean or
?