Basic library functions Flashcards

1
Q

What does the library function head do?

A

Returns the first element of a list

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

What does the library function tail do?

A

Removes the first element and returns the list

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

What does !! do?

A

Selects the nth element of a list

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

What does take do?

A

Select the first n elements of a list

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

What does the function drop do?

A

Removes the first n elements from a list and returns list

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

What does function length do?

A

Returns the length of the list

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

What does the function sum do?

A

Add the elements in the list together and return the result

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

What does the function product do?

A

Multiplies each element in the list together and returns the result

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

what does the operation ++ do?

A

Appends two lists together

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

What does the function reverse do?

A

Reverses a list

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

Name as many library functions as you can!!

A

head
tail
take
drop
reverse

!!
++

length
sum
product

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

What is the principle of Haskell?

A

Write clear concise and correct code

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

What is some of Haskells syntax?

A
  • No capital letters for function names
  • Back quotes for strings/characters
  • Brackets around functions in functions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly