Flashcards
Fundamentals of Functional Programming FINISHED
Cards in this deck (12)
- 1Define the domain and co domain of a function- The domain is a SET from which the function’s input values are chosen.
- The co domain is a SET from which the function’s output values are chosen. Not all of the co domain’s members need to be outputs. - 2What is a first-class objectFirst-class objects are objects which may:
• appear in expressions
• be assigned to a variable
• be assigned as arguments
• be returned in function calls
(e.g., integers, characters, etc) - 3What is the type of a functiontype of argument 1 → type of argument 2 → … = type of output
- 4Define partial function applicationA function application scheme where a function is decomposed into intermediate partial functions. A partial function takes some of the arguments and returns a function awaiting the remaining arguments
- 5g . f (3, 4) meansg( f(3, 4))
(Composition of functions: The combination of 2 functions to produce a new function that performs the two functions in a specific order) - 6What is a higher order functionA function is higher-order if it takes a function as an argument or returns a function as a result, or does both.
- 7Mapmap is the name of a higher-order function that applies a given function to each element of a list, returning a list of results.
- 8filterfilter is the name of a higher-order function that processes a data structure, typically a list, in some order to produce a new data structure containing exactly those elements of the original data structure that match a given condition.
- 9reduce or foldreduce or fold is the name of a higher-order function which reduces a list of values to a single value by repeatedly applying a combining function to the list values.
- 10notesKnow that a function is a first-class object in functional programming languages and in imperative programming languages that support such objects.
This means that it can be an argument to another function as well as the result of a function call. - 11Define function applicationFunction application means a function applied to its arguments.
The process of giving particular inputs to a function is called function application, for example add(3,4) represents the application of the function add to integer arguments 3 and 4.
The type of the function is
f: integer x integer → integer
where integer x integer is the Cartesian product of the set integer with itself.
Although we would say that function f takes two arguments, in fact it takes only one argument, which is a pair, for example (3,4). - 121. What is the head and what is the tail for list [4, 3, 5]1. 4 (head), [3, 5] (tail)
Information
- Description
- A level Computing Flashcards on Fundamentals of Functional Programming FINISHED, created by Mr Wiggly Gamer A.C on 12/03/2023.
- Created by
- Mr Wiggly Gamer A.C
- Views
- 0
- Rating