Template:Infobox programming language
Hope is a programming language based on functional programming developed in the 1970s at the University of Edinburgh.<ref name="BMS">Template:Cite book</ref><ref> Template:Cite book</ref> It predates Miranda and Haskell and is contemporaneous with ML, also developed at the University. Hope was derived from NPL,<ref name="design"/> a simple functional language developed by Rod Burstall and John Darlington in their work on program transformation.<ref>Template:Cite journal</ref> NPL and Hope are notable for being the first languages with call-by-pattern evaluation and algebraic data types.<ref>Template:Cite book</ref>
Hope was named for Sir Thomas Hope (c. 1681–1771), a Scottish agriculture reformer, after whom Hope Park Square in Edinburgh, the location of the artificial intelligence department at the time of the development of Hope, was also named.
The first implementation of Hope used strict evaluation, but there have since been lazy evaluation versions and strict versions with lazy constructors. A successor language Hope+, developed jointly between Imperial College and International Computers Limited, added annotations to dictate either strict or lazy evaluation.<ref name=annotations>Template:Cite book</ref>
Language detailsEdit
A factorial program in Hope is:
dec fact : num -> num; --- fact 0 <= 1; --- fact n <= n*fact(n-1);
Changing the order of clauses does not change the meaning of the program, because Hope's pattern matching always favors more specific patterns over less specific ones. Explicit declarations of data types in Hope are required; there is no type inference algorithm.
Hope provides two built-in data structures: tuples and lists.<ref name=byte/>
ImplementationsEdit
Roger Bailey's Hope tutorial in the August 1985 issue of Byte references an interpreter for IBM PC DOS 2.0.<ref name=byte/> British Telecom embarked on a project with Imperial College London to implement a version of Hope. The first release was coded by Thanos Vassilakis in 1986. Further releases were coded by Mark Tasng of British Telecom.