Programming Pradigm Flashcards
What is an imperative program?
Programming languages based on the 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.
Give an example of an imperative paradigm?
- procedural programming.
What is a functional paradigm?
The functional paradigm uses programming languages that evaluate mathematical functions, rather than the imperative method where values are assigned to variables; to summarise, variables are determined by calling functions.
What are functional programs used for?
Functional programs are used to solve problems in complex structures where the code created is brief and it is, therefore, easier to determine errors
What is a logic paradigm?
The logic paradigm is especially useful in solving problems that involve querying and gaining knowledge from declared facts and their rules.
What is Prolog?
Prolog is a declarative logic programming language that is widely used in artificial intelligence and in expert system applications; it is useful for rule-based systems
What is object orientated paradigm?
The object-oriented paradigm is based on data structures known as objects; these objects are members of a class which are grouped into a class hierarchy.
What is an Function?
A function can be defined as a relation between input values from the domain to a set of possible outputs from the codomain, in which each input is related to exactly one output
What is a first class object?
A first-class object is a language object which supports the operations normally available to other entities
What entities are first class objects available to?
- 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
What can first class objects consist of?
In many programming languages, first-class objects can consist of the following: integers, floating-point values, characters and strings.
Why do functional programs make use of high order functions and first class objects?
Functional programming makes use of higher-order functions and first-class objects, since they can be used as an argument for another function and as the result of a function call.
What is Function application?
Function application is the process of providing a function with an input value from its domain to determine an output from its codomain
What is partial function application?
Partial 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. A new function is then created to carry out the final part of the function.
What is Composition of Functions?
Composition of functions is the process of combining two functions by applying the results of one function to another.