Functional programming Flashcards

(12 cards)

1
Q

what are integers

A

numbers with their negative counterparts including zero ( -1 . -2, -3 , 0 , 1 2 3 )

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

what are domain

A

A set of which the function input are chosen

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

What is codomain

A

This is the set of which output from a functionional programming

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

What are natural numbers

A

Start with 0 upward 1 , 2 , 3 ,4

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

What is rational numbers

A

This can represent fractions

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

What is irrational number

A

This cannot be represented as a fraction

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

WHat is high order functions

A

Functions that take a function as an argument or returns a functions as a result or both

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

What is map

A

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

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

WHat is fold

A

Reduces the list to a single value

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

What is filter

A

Returns the elements of the list to adhere to the condition given

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

Features of a functional program

A

High order function
Immutable
Stateless

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

Describe how the total function works to add up all of the numbers in a list.

total [] = 0

total (x:xs) = x + total (xs)

A

It uses recursion
It splits the list to an head and tail
The recursion ends when the list is empty

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