Prolog Language Difference Lists


Difference Lists in Prolog denotes the concept to know the structure of a list up to a point. The remaining of the list can be left unbound until the complete evaluation of a predicate. A list where its end is unknown is referred as an open list, ended by a hole. This technique is especially useful to validate complex syntaxes or grammars.

The well-known Definite Clause Grammars (DCG) is using Difference Lists to operate under the hood.