Lists are backed by arrays now, so random access is O(1). I was considering making an extra array type, but the array-backed list will work just as well and keep the type system cleaner.
<list iteration for> ::= (for <scalar-variable> in <list> <expression>*)Range iteration form:
<range iteration for> ::= (for <scalar-variable> in <start-index> to <end-index> <expression>*) <start-index> ::= <integer> | <scalar-variable> <end-index> ::= <integer> | <scalar-variable>
In the list iteration case, the scalar-variable will be the
currently indexed element in the list. In order to obtain the current
index count for this case, the special variable
<scalar-variable>-index is provided. In the range iteration case,
the scalar-variable is the loop index.
<if-then-else> ::= (if <boolean-condition> <expression>* else <expression>)
<function> ::= (fn <name> (<parameter>*) <expression>*) <name> ::= <symbol> <parameter> ::= <symbol>
(fn fib ($num) (if (< $num 2) $num else (+ (fib (- $num 1)) (fib (- $num 2))) ) ) (fn fact ($num) (if (== $num 0) 1 else (* $num (fact (- $num 1))) ) )
-m