Tutorial ======== This tutorial consists of a language tour and a set of exercises, in the order of mentioning. Tour ---- **Arithmetic operations** Addition, multiplication, subtraction and division are supported with +, *, - and / respectively. ```console > (+ 1 1) 2 : Int > (* 2 3) 6 : Int > (- 5 4) 1 : Int > (/ 4 2) 2 : Int ``` Decimals are truncated in division: ```console > (/ 5 2) 2 : Int ``` **Lists** Lists in myslip correspond to what is known as tuples in many other programming languages. This difference exists because myslip is a list processor, and not using this underlying construct of the language would be odd. In principle, ```myslip (1 2 3 4 5) ``` is a valid list, but it is evaluated by the interpreter, which assumes that the first term, `1`, is an operator. That's why constructing a list requires the operator `quote`: ```console > quote quote : (T -> T) > (quote 1 2 3 4 5) (quote 1 2 3 4 5) : (Int Int Int Int Int) ``` As hinted above, `quote` is typewise the identity function. Behaviorally it does though simplify sub-expressions. ```console > (quote (+ 1 1) (+ 2 2)) (quote 2 4) : (Int Int) ``` The elements of a list can of course be of different types: ```console > (quote + 0 (quote 1 2)) (quote + 0 (quote 1 2)) : (((Int Int) -> Int) Int (Int Int)) ``` TODO: List destructuring **Understanding error messages** TODO: div zero TODO: unclosed parenthesis TODO: type errors Exercises --------- TODO