Hope programming language
Encyclopedia
Hope is a small functional programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 developed in the 1970s at Edinburgh University
University of Edinburgh
The University of Edinburgh, founded in 1583, is a public research university located in Edinburgh, the capital of Scotland, and a UNESCO World Heritage Site. The university is deeply embedded in the fabric of the city, with many of the buildings in the historic Old Town belonging to the university...

. It predates Miranda
Miranda programming language
Miranda is a non-strict purely functional programming language designed by David Turner as a successor to his earlier programming languages SASL and KRC, using some concepts from ML and Hope. It was produced by Research Software Ltd...

 and Haskell
Haskell (programming language)
Haskell is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing. It is named after logician Haskell Curry. In Haskell, "a function is a first-class citizen" of the programming language. As a functional programming language, the...

 and is contemporaneous with ML (also developed at Edinburgh). It is notable for being the first language with call-by-pattern evaluation and algebraic data type
Algebraic data type
In computer programming, particularly functional programming and type theory, an algebraic data type is a datatype each of whose values is data from other datatypes wrapped in one of the constructors of the datatype. Any wrapped datum is an argument to the constructor...

s. Hope is an important language in the development of functional programming.

The name may have been derived from Hope Park Square in Edinburgh, at one time the location of the Department of Artificial Intelligence.

A Hope tutorial by Roger Bailey was featured in the August 1985 issue of Byte on declarative programming
Declarative programming
In computer science, declarative programming is a programming paradigm that expresses the logic of a computation without describing its control flow. Many languages applying this style attempt to minimize or eliminate side effects by describing what the program should accomplish, rather than...

.

A factorial program in Hope is
dec fact : num -> num;
--- fact 0 <= 1;
--- fact n <= n*fact(n-1);
Unlike in Haskell
Haskell (programming language)
Haskell is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing. It is named after logician Haskell Curry. In Haskell, "a function is a first-class citizen" of the programming language. As a functional programming language, the...

, changing the order of the clauses would 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
Lazy evaluation
In programming language theory, lazy evaluation or call-by-need is an evaluation strategy which delays the evaluation of an expression until the value of this is actually required and which also avoids repeated evaluations...

versions and strict versions with lazy constructors (the language described in has a lazy constructor for lists only).

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK