## Syntax and Special Forms |Special Form|Argument Evaluations|Purpose| |:-|-|-| |`(if cond a b)`|`if` only evaluates its `cond` argument. If `cond` is truthy (non-zero), then `a` is evaluated. Otherwise, `b` is evaluated.|This special form is the main method of control flow.| |`(do a b c ...)`|`do` takes a list of s-expressions and evaluates them in the order they were given (in the current scope), and then returns the result of the last s-expression.|This special form allows lambda functions to have multi-step bodies.| |`(scope a b c ...)`|`scope` takes a list of s-expressions and evaluates them in the order they were given _in a new scope_, and then returns the result of the last s-expression.|This special form allows the user to evaluate blocks of code in new scopes.| |`(defun name params body)`|`defun` evaluates none of its arguments.|This special form allows the user to conveniently define functions.| |`(define name value)`|`define` evaluates the `value` argument, which is then assigned to `name` in the current scope.|This special form allows the user to bind atoms to values in a scope.| |`(lambda params body)`|`lambda` evaluates none of its arguments.|This special form allows the user to define anonymous functions.| |`(quote x)`|`quote` evaluates none of its arguments.|This is equivalent to the `'expr` syntactic sugar.| |`(for x list ...)`|`for` evaluates only its list argument.|`for` iterates through the list storing each element in `x`, and then evaluating all of the rest of the values in the `for` body. It then returns the last value evaluated.| |`(while cond ...)`|`while` evaluates only its cond argument.|`while` evaluates its condition expression every iteration before running. If it is true, it continues to evaluate every expression in the `while` body. It then returns the last value evaluated.| ## Library #### Using the binary Run ml in interactive mode: ```bash $ ./ml >>> (print "Hello world!") Hello world! => "Hello world!" ``` Interpret a file: ```bash $ ./ml -f "examples/hello_world.lisp" Hello world! ``` Interpret from command line argument: ```bash $ ./ml -c '(print "Hello world!")' Hello world! ```