Building a little unification engine with the continuation-passing style

Continuation passing style in functional programming is a paradigm in which the programmer, while building their procedures, specifies a function called the continuation that handles what is to be done after the work of that very procedure is done. While in normal or direct style, return values are often flowing between different callee and caller functions, in continuation passing style the caller just specifies what is to be executed by the callee once it has finished its computation.

In continuation passing style, every function takes an extra argument in relation to its "direct style" counterpart: a continuation that is to be launched on its result. To better understand ...

Get Clojure Data Structures and Algorithms Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.