functions Flashcards

0
Q

min

A

min x y
if x ≤ y
then x
else y

x, y ∈ ℝ

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

succ

A

succ x = x + 1

x ∈ ℝ

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

max

A

max x y
if x ≥ y
then x
else y

x, y ∈ ℝ

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

&&

A

boolean „and”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

||

A

boolean „or”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

:

A

x:[]
adds x to list []
x ∈ ℝ

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

let

A

defines right in ghci

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

!!

A

!! n

gets the n-th element of the list (indices begin with ‘0’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

head

A

takes a list and returns its first element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

tail

A

takes a list and returns it without the head as element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

last

A

takes a list and return its last element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

init

A

takes a list and returns it without the last element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

length

A

takes a list and returns the amount of elements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

null

A

checks if a list is empty

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

reverse

A

reverse [a,b,c]

→[c,b,a]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

take

A

take 3 [a,b,c,d,e]

→[a,b,c]

17
Q

drop

A

drop 3 [a,b,c,d,e]

→[c,d,e]

18
Q

maximum

A

takes a list of stuff, that can be put in some kind of order and returns the biggest element

19
Q

minimum

A

like maximum, but returns the smallest element

21
Q

not

A

boolean „not“

22
Q

sum

A

takes a list of numbers and returns their sum

23
Q

product

A

takes a list of numbers and returns their product

24
Q

elem

A

takes a thing and a list of things and tells us if that thing is element of the list

25
Q

mod

A

mod a b

returns the remainder of a when divided with b

26
Q

odd

A

odd a

returns True on an odd number and False on an even one