Instructors' Guide


Introduction Terminology Expressions Control Objects Inheritance Technology Summary

Expressions

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 [ ] ), variables (which by convention start with a capital or underscore), or compound terms (which may be written as a function symbol with argument terms or as a list of the form [ H | T ], where H stands for the head of the list and T for its tail). See slide dlp-expr.

Expressions -- terms

Prolog


Unification -- bi-directional parameter passing


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 syntactically equal. 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.