Difference lists can be implemented using first-class functions or using unification.
As functions, difference lists are a Cayley representation of lists as monoids, or more specifically their transformation monoid induced by left multiplication.
Examples of use are in the ShowS type in the Prelude of Haskell, and in Donald Bruce Stewart's difference list library for Haskell.
[2] Another implementation in the logic programming language Prolog uses unification variables.
This algorithms or data structures-related article is a stub.