Cons constructor :: appends item to the beginning of a list, but does not modify the original list since all variables are immutable
element::list
(‘a → ‘a list → ‘a list)
(e1:t list @ e2:t list): t list
(‘a list → ‘a list → ‘a list)
Match expression
(match e1: t with
p1 -> e2:t2
|p2 -> e3:t2
|...
|px -> ex:t2):t2A list is
- an element that points to another list
- an empty list
let rec add1 lst = match lst with
[] -> []
|element::rest -> (element + 1)::(add1 rest)RECURSION!
let rec mult5mtx mtx = match mtx with
[] -> []
|row::rest -> (mult5row row)::(mult5mtx mtx)
let rec mult5row row = match row with
[] -> []
|element::rest -> (element * 5)::(mult5row rest)