Back to marketplace

Functional Programming

No description yet. This curated deck is ready for daily study.

Total cards: 24•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (24)

#1
Front (Question)

What is a function type? How would you write this?

Back (Answer)

It describes what the input and output values are. E.g. inputting integers, outputting real numbers Written like this: f: integer –> real (f: A –> B) A is the argument type and B is the result type

#2
Front (Question)

What could changing the function type do?

Back (Answer)

The functionality could change without changing the instructions as different input values would be accepted.

#3
Front (Question)

Explain each part of this f: A –> B

Back (Answer)

F is the function name, A is the domain, B is the co-domain

#4
Front (Question)

What is the definition of a function in functional programming?

Back (Answer)

A rule that for each element in a set of inputs, assigns an output chosen from another set

#5
Front (Question)

What is the definition of a domain in functional programming?

Back (Answer)

A domain is a set from which a function’s input values are chosen.

#6
Front (Question)

What is the definition of a co-domain in functional programming?

Back (Answer)

A co-domain is a set from which the function’s output values are chosen.

#7
Front (Question)

What are the benefits of the functional programming paradigm?

Back (Answer)

• Supports the decomposition and abstraction of computing problems into functions that are made up of other functions • Is suitable for running parallel and concurrent program execution, which allows programs to run on multiprocessor systems

#8
Front (Question)

What is a first-class object?

Back (Answer)

An object which can appear in an expression, be assigned to a variable, be assigned as an argument and be returned in function calls.

#9
Front (Question)

Not all combinations of functions are possible. Explain why this is.

Back (Answer)

A combination won’t work if: • It doesn’t have the same number of inputs as outputs • The type of the input isn’t the same as the type of the output

#10
Front (Question)

What is a higher order function?

Back (Answer)

• A function that can take functions as arguments or/and can return a function as a result

#11
Front (Question)

What does the map function do?

Back (Answer)

It applies a function to all the items in a list

#12
Front (Question)

What does the filter function do?

Back (Answer)

Returns the elements in the domain that satisfy a given condition.

#13
Front (Question)

What does the fold function do? What is the difference between foldl and foldr? Fold is also known as reduce

Back (Answer)

Reduces the list to a single value by applying a given operator to the values in the list. (usually adding) Foldl means fold left, foldr means fold right for example: foldr (-) 100 {2,4,6,8,10) would equal -94 whereas foldl (-) 100 {2,4,6,8,10) would equal 70

#14
Front (Question)

Name the three first class objects in functional programming.

Back (Answer)

Functions Integers Variables

#15
Front (Question)

How many arguments can a haskell function take?

Back (Answer)

1, though it can look like 2 arguments are being taken, they are taken as a pair, which is treated as1 argument

#16
Front (Question)

What is the purpose of partial function application?

Back (Answer)

It allows the processing of multiple arguments by a function.

#17
Front (Question)

What is meant by the head of a list in functional programming?

Back (Answer)

The first item in the list.

#18
Front (Question)

What is meant by the tail of a list in functional programming?

Back (Answer)

All the items in the list apart from the first.

#19
Front (Question)

How many data types can a list in a purely functional language contain?

Back (Answer)

1

#20
Front (Question)

In functional programming languages, data structures like lists are immutable. What does this mean?

Back (Answer)

The list cannot be changed once created.

#21
Front (Question)

Two functions are defined as follows f x y = x + y and g x = x * x. Why is it not possible to combine these functions as f.g?

Back (Answer)

Because f takes two arguments and g only takes one.

#22
Front (Question)

What is a higher order function?

Back (Answer)

A function which takes a function as an argument, returns a function as a result, or does both.

#23
Front (Question)

What is an argument?

Back (Answer)

The pieces of data that are passed into a function

#24
Front (Question)

Give an example of type declaration of a function for multiplying two integers

Back (Answer)

MultiplyUs : : : int –> int –> int the first two int’s tell us the argument type, the last int tells us the result type