22.02.02 - Functional Language
Functional Language
Functional programming is style of programming maths
Easier to program functional than using computation method with assignments (java/c/for loop)
Instead of doing for loop can do. This builds a list 1 - 10
sum [1..10]
1987 - An international committee starts the development of Haskell, the standard lazy functional language
f(x:xs) = f ys ++ [x] ++ f zs
++
- appends lists together
:
- Takes single item(number) and moves it into the list. Can also be used to break apart the list. x:xs
always adds a new element x
to the start of a list xs
[a | a ← xs, a ≤ x]
Building a set of all values a
, such that is is element of xs
and a is ≤
to x