Mutable Variables VariableMutation nat7.png https://docs.google.com/a/brown.edu/forms/d/e/1FAIpQLSeNtl4ToduAx3xETKi0JnC5gIzMoPIrXaOD9zgaQW6hk5As5g/viewform core1 core2 extra1 Nil nil

The sole value of the Nil type. `nil` is frequently used to represent the absence of a value.

Let let <name> = <expr>; ...

Evaluates `expr`, and binds the result to `name`.

Parentheses (<expr>)

Parentheses are used for grouping expressions. They do not otherwise change the meaning of the program.

Number Literals 9000.1 -42 9.0001e+3

Evaluation of a number literal yields a numeric value. Integer, decimal, and scientific notation is supported.

Binary Arithmetic Operations <expr> + <expr> <expr> - <expr> <expr> * <expr> <expr> / <expr>

These arithmetic operations raise exceptions if their arguments do not evaluate to numbers. Otherwise, they perform the specified operation.

Booleans true false

The true and false values of the boolean type.

String Literals "I am a string."

Evaluation of a string literal yields a string value. String values hold ordered sequences of characters. They are usually used as representations of human readable text.

String Concatenation <expr> ++ <expr>

Appends two strings together. This does not modify the strings, but instead produces a new string.

Comparisons <expr> < <expr> <expr> > <expr> <expr> <= <expr> <expr> >= <expr> <expr> == <expr> <expr> != <expr>

These operations perform the specified comparison, returning a boolean. Only numbers can be compared.

Conditionals if <condition> { <then_branch> } else { <else_branch> }

Evaluates the `condition`, followed by either the `then_branch` or the `else_branch`, depending on its result.

Function Declaration func <name>(<param>, ...) { <expr> }; ...

Evaluating a function statement produces a function value and binds it to `name`. The function definition does not evaluate the function body; this happens when the function is called.

Function Application <expr>(<expr>, ...)

Applies a function to zero or more arguments.

Assignment Statement <name> := <expr>; ...

Evaluates `expr`, and changes the value bound to `name`.

Lambda Expression lambda(<param>, ...) { <expr> }

Produces a first-class function value. It can be applied the same way as named functions.

Mutable Variables Focus on how variable assignment and function application interact. We weren't sure how this should work so we outsourced it to Elbonia.