12.2 Writing functional programs Flashcards

1
Q

What does the Map function do?

A

Takes a second function and applies it to a list of elements before returning the new list

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

What does the filter function do?

A

Returns the elements of the list which adhere ti the condition given. It is IN rather than a filter OUT.

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

What does the fold function do?

A

Reduce the list to a single value. Known as reducing. The function needs an operator (+,-) a starting number and a list. The type - left or right - determines how the recursion will work.

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