Topic 12 - Fundamentals of functional programming - Complete Flashcards
Define imperative paradigm?
Make use of assignments or statements which are written to and therefore change the state of computer memory. Imperative languages can be translated into efficient machine code.
Define functional paradigm?
Uses programming languages that evaluate mathematical functions, rather than the imperative method where the values are assigned to variables.
Define logic paradigm?
Useful in solving problems that involve querying and gaining knowledge from declared facts and their rules.
Prolog is a declarative logic programming language that is widely used in artificial intelligence and in expert system applications.
Define object-orientated paradigm?
Is based on data structures known as objects, these objects are members of a class which are grouped into a class hierarchy.
Define first-class object?
Is a language object which supports the operations normally to other entities like:
- Appearing in expressions
- Being assigned to a variable
- Being used as an argument for a function
- Being returned as an output from a function call
Define function application?
Can be applied to a function that requires more than one argument. This can then be processed by applying the function with some but not all of the arguments needed.
Define composition function?
Is the process of combining two functions by applying the results of one function to another.
This technique is widely used in functional programming, where complex functions can be constructed by using simpler functions.
Define map function?
Applies a given function to each of the elements in a list to form another list with results.
Define filter function?
Is a higher-order function that processes a list of data structure to create a new list containing elements that match the specified criteria.
Define even number filter?
The filter function example using Haskell is based on finding even numbers in the list.
Define reduce or fold function?
Is a method that can be used to reduce a list to a single value by combining the list using recursive function.
Define list processing?
Is a data structure consisting of a list of data elements that are of the same data type and size, the list is named by an identifier and the structure elements stored can be integers, real numbers, characters or text strings.
Define empty list?
A list with no elements is termed an empty list and is shown using the symbols.