Hope is a small functional programming language developed in the 1970s at Edinburgh University. It predates Miranda and Haskell and is contemporaneous with ML (also developed at Edinburgh). Hope was derived from NPL, a simple functional language developed by Rod Burstall and John Darlington in their work on program transformation. NPL was, in turn, derived from Kleene Recursion Equations. NPL and Hope are notable for being the first languages with call-by-pattern evaluation and algebraic data types. (Though SNOBOL is even older, and its 'patterns' may qualify as a hybrid between call-by-pattern and regular expression matching.) Hope is an important language in the development of functional programming.
Hope was named for Sir Thomas Hope (c. 1681–1771), a Scottish agricultural reformer, after whom Hope Park Square in Edinburgh, the location of the Department of Artificial Intelligence at the time of the development of Hope, was also named.
A factorial program in Hope is:
Unlike Haskell, changing the order of the clauses does not change the meaning of the program, because Hope's pattern matching always favors more specific patterns over less specific ones. Another way in which Hope differs from Haskell and ML is that explicit type declarations in Hope are required: there is no option to use a type-inference algorithm in Hope.
The first implementation of Hope was strict, but since that one there have been lazy versions and strict versions with lazy constructors (the language described in has a lazy constructor for lists only).