toString ( <Expr> ) toInt ( <Expr> ) toFloat ( <Expr> )
toString, as the name implies, converts its argument to a string. It
can be applied to _
Integer_s and _
Float_s. It currently cannot be
applied to _
Boolean_s or any other types.
toFloat work similarly, and on the same three types
toInt will truncate floats (the same behavior as casting in C.)
Note: We’re really sorry about the asymmetry of
toIntbeing abbreviated, while none of the others are. That parser was feeling lonely again, and it has a gun.
will return the string
will return the integer
error ( <Expr> )
error takes a string argument, and returns any type necessary. It should
be used to produce unexpected errors, as they immediately terminate the program
when evaluated. Do not use this to report semantic errors in an AST; use it
for internal compiler errors.
if null(something) then error("unexpected empty list!") else dosomething(head(something))