
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

val
char (#โxโ) string (โxโ) int real bool aโ (all types) list
0 => constant 0 (int) _ => any given param matches (a, b, c) => tuple of three elements [a, b, c] => list of three elements (x :: rest) => matches non-emtpy list, x is head (x1 :: x2 :: rest) => matches list 1 elements, ... ... x1 is head, x2 element after head
fun fact 0 = 1 | fact n = n * fact (n-1);
~ (negation) +, -, *, /, div (int quotient), mod (int remainder) ^ (string concat)
, <, <=, >= (for all numbers) =, <> (not for reals!)
List = all same type, >= 2 elements Tuple = all types possible () => tuple [] => emtpy list (= nil) [1] int list with โ1โ 1 :: 2 :: 3 :: [] => [1, 2, 3] hd () => first element tl (
) => rest elements in list
explode ( => string real (
=> apply
foldr
=> f(x1, f(x2, (...) f(xn, c)) foldl
=> f(xn, f(xn-1, (...) f(x1, c))
if
case