Curry: Example Programs

Here is a collection of (small) Curry programs. References to larger applications can be found here. Usually, each program contains some example goals at the end in order to see its intended application.


The programs are sorted by the main language features they use so that people interested in the various features of Curry can look at these examples:

Purely functional programs:


Purely logic programs:


Functional logic programs:


Non-deterministic functions:


Passive constraints (logic programming with coroutining):


Residuation and concurrent programming:


Input/Output (monadic I/O):


Arithmetic sequences and list comprehensions:


Encapsulated search:


Modules:


Comparison with Escher:

Here are a few examples that are implementations of programs from John Lloyd's papers on Escher.

Functional logic programming with constraints:

Important note: The programs in this section work only with implementations of Curry that support real arithmetic and finite domain constraints, see, for instance, PAKCS.

Distributed functional logic programming

Important note: Most of the programs in this section work only with implementations of Curry that support distributed programming with port constraints as described in the PPDP'99 paper.

Examples for meta-programming

Important note: The programs in this section work only with the libraries of the PAKCS environment for meta-programming (see library directory pakcs/lib/meta of the current PAKCS distribution).

Examples for the GUI library "GUI"

Important note: The programs in this section work only with the library GUI which is available for the PAKCS environment. A description of the ideas behind this library can be found in the PADL'00 paper. Most of the programs have a function "main" to start the GUI.

Examples for the deprecated GUI library "Tk"

Important note: The programs in this section work only with the GUI library Tk which is available for the PAKCS environment. This library will no longer be supported in the future since a similar but improved library GUI (see examples) is available. A description of the ideas behind this library can be found in the PADL'00 paper. Most of the programs have a function "main" to start the GUI.

Examples for functional logic parsers

Here are simple examples for the use of the functional logic parser combinators which are defined in the parser library Parser and are adapted from the paper "A Functional Logic Perspective of Parsing" by R. Caballero and F.J. Lopez-Fraguas (Proc. FLOPS'99, Springer LNCS 1722, pp. 85-99, 1999).

Various example programs


Back to Homepage of Curry
Michael Hanus