Curry (programming language)

In contrast to Haskell, Curry has built-in support for non-deterministic computations involving search.

This follows from a fundamental property of pure functional languages, termed referential transparency: the value of a computed result does not depend on the order or time of evaluation, due to the absence of side effects.

As many functional languages like Haskell do, Curry supports the definition of algebraic data types by enumerating their constructors.

For instance, the type of Boolean values consists of the constructors True and False that are declared as follows: Functions on Booleans can be defined by pattern matching, i.e., by providing several equations for different argument values: The principle of replacing equals by equals is still valid provided that the actual arguments have the required form, e.g.: More complex data structures can be obtained by recursive data types.

We can define operations on recursive types by inductive definitions where pattern matching supports the convenient separation of the different cases.

Narrowing is a mechanism whereby a variable is bound to a value selected from among alternatives imposed by constraints.

Each possible value is tried in some order, with the remainder of the program invoked in each case to determine the validity of the binding.

Curry can express this property also in the following more concise way: Haskell does not allow such a declaration since the pattern in the left-hand side contains a defined function (++).

Since Curry is able to solve equations containing function calls with unknown values, its execution mechanism is based on non-deterministic computations, similarly to logic programming.

Due to the absence of side effects, a functional logic program can be executed with different strategies.