functions Flashcards
0
Q
min
A
min x y
if x ≤ y
then x
else y
x, y ∈ ℝ
1
Q
succ
A
succ x = x + 1
x ∈ ℝ
2
Q
max
A
max x y
if x ≥ y
then x
else y
x, y ∈ ℝ
3
Q
&&
A
boolean „and”
4
Q
||
A
boolean „or”
5
Q
:
A
x:[]
adds x to list []
x ∈ ℝ
6
Q
let
A
defines right in ghci
8
Q
!!
A
!! n
gets the n-th element of the list (indices begin with ‘0’)
9
Q
head
A
takes a list and returns its first element
10
Q
tail
A
takes a list and returns it without the head as element
11
Q
last
A
takes a list and return its last element
12
Q
init
A
takes a list and returns it without the last element
13
Q
length
A
takes a list and returns the amount of elements
14
Q
null
A
checks if a list is empty
15
Q
reverse
A
reverse [a,b,c]
→[c,b,a]