The expressiveness of DLP is derived to a large extent
from its heritage from Prolog.
The basic syntactic units in Prolog are terms,
which are either constants
(such as characters, integers, strings, or the empty list
(which by convention start with a capital or underscore),
(which may be written as a function symbol with
argument terms or as a list of the form ,
where H stands for the head of the list and T for its
Expressions -- terms
- constants -- a, "a string", [ ]
- variables -- X,Y,Z
- compound -- f(a,X), [ H | T ]
Unification -- bi-directional parameter passing
- f(X,a) = f(b,Y) results in X = b and Y = a
slide: DLP -- expressions
Terms allow for what is called unification,
which is an extended form of pattern matching.
Unification results in binding variables to terms,
in such a way that the two unified terms become
As an example, unifying f(X,a) with f(b,Y)
results in binding X to a and Y to b.
Unification is the primary mechanism of parameter
passing in Prolog.
It is essentially bi-directional and satisfies
the one-assignment-only property,
which means that evaluating a goal must result
in a consistent binding, otherwise the goal fails.