In computer science, imperative programming is a programming
paradigm that describes computation in terms of statements that
change a program state. In much the same way that imperative
mood in natural languages expresses commands to take action,
imperative programs define sequences of commands for the
computer to perform.
In computer science, functional programming is a programming
paradigm that treats computation as the evaluation of mathematical
functions and avoids state and mutable data. It emphasizes the
application of functions, in contrast to the imperative programming
style, which emphasizes changes in state. Functional programming
has its roots in lambda calculus, a formal system developed in the
1930s to investigate function definition, function application, and
recursion. Many functional programming languages can be viewed as
elaborations on the lambda calculus.
Logic programming languages, of which PROLOG (programming
in logic) is the best known, state a program as a set of logical
relations (e.g., a grandparent is the parent of a parent of someone).
Such languages are similar to the SQL database language. A
program is executed by an “inference engine” that answers a query
by searching these relations systematically to make inferences
that will answer a query. PROLOG has been used extensively in
natural language processing and other AI programs.