Hope (programming language)

Last updated

Hope is a small functional programming language developed in the 1970s at the University of Edinburgh. [1] [2] It predates Miranda and Haskell and is contemporaneous with ML, also developed at the University. Hope was derived from NPL, [3] a simple functional language developed by Rod Burstall and John Darlington in their work on program transformation. [4] NPL and Hope are notable for being the first languages with call-by-pattern evaluation and algebraic data types. [5]

Contents

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.

Language details

A factorial program in Hope is:

dec fact : num -> num; --- fact 0 <= 1; --- fact n <= n*fact(n-1);

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. Explicit type declarations in Hope are required; there is no option to use a type-inference algorithm in Hope.

Hope provides two built-in data structures: tuples and lists. [6]

Implementations

The first implementation of Hope was strict, but since that one there have been lazy versions and strict versions with lazy constructors. British Telecom embarked on a project with Imperial College to implement a strict version. The first release was coded by Thanos Vassilakis in 1986. Further releases were coded by Mark Tasng of British Telecom. A successor language Hope+ (developed jointly between Imperial College and International Computers Limited (ICL) added annotations to dictate either strict or lazy evaluation. [7]

Roger Bailey's Hope tutorial in the August 1985 issue of BYTE references an interpreter for IBM PC DOS 2.0. [6]

Related Research Articles

In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that map values to other values, rather than a sequence of imperative statements which update the running state of the program.

In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an expression until its value is needed and which also avoids repeated evaluations.

ML is a functional programming language. It is known for its use of the polymorphic Hindley–Milner type system, which automatically assigns the types of most expressions without requiring explicit type annotations, and ensures type safety – there is a formal proof that a well-typed ML program does not cause runtime type errors. ML provides pattern matching for function arguments, garbage collection, imperative programming, call-by-value and currying. While a general-purpose programming language, ML is used heavily in programming language research and is one of the few languages to be completely specified and verified using formal semantics. Its types and pattern matching make it well-suited and commonly used to operate on other formal languages, such as in compiler writing, automated theorem proving, and formal verification.

<span class="mw-page-title-main">Miranda (programming language)</span>

Miranda is a lazy, 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. of England and was the first purely functional language to be commercially supported.

<span class="mw-page-title-main">Clean (programming language)</span>

Clean is a general-purpose purely functional computer programming language. It was called the Concurrent Clean System, then the Clean System, later just Clean. Clean has been developed by a group of researchers from the Radboud University in Nijmegen since 1987.

ISWIM is an abstract computer programming language devised by Peter Landin and first described in his article "The Next 700 Programming Languages", published in the Communications of the ACM in 1966.

Oz is a multiparadigm programming language, developed in the Programming Systems Lab at Université catholique de Louvain, for programming language education. It has a canonical textbook: Concepts, Techniques, and Models of Computer Programming.

A list comprehension is a syntactic construct available in some programming languages for creating a list based on existing lists. It follows the form of the mathematical set-builder notation as distinct from the use of map and filter functions.

Curry is an experimental functional logic programming language, based on the Haskell language. It merges elements of functional and logic programming, including constraint programming integration.

A strict programming language is a programming language which employs a strict programming paradigm, allowing only strict functions to be defined by the user. A non-strict programming language allows the user to define non-strict functions, and hence may allow lazy evaluation.

The Glasgow Haskell Compiler (GHC) is a native or machine code compiler for the functional programming language Haskell. It provides a cross-platform software environment for writing and testing Haskell code and supports many extensions, libraries, and optimisations that streamline the process of generating and executing code. GHC is the most commonly used Haskell compiler. It is free and open-source software released under a BSD license. The lead developers are Simon Peyton Jones and Simon Marlow.

In computer science, graph reduction implements an efficient version of non-strict evaluation, an evaluation strategy where the arguments to a function are not immediately evaluated. This form of non-strict evaluation is also known as lazy evaluation and used in functional programming languages. The technique was first developed by Chris Wadsworth in 1971.

NPL is a functional programming language with pattern matching designed by Rod Burstall and John Darlington in 1977. The language allows certain sets and logic constructs to appear on the right hand side of definitions, e.g.

setofeven(X) <= <:x: x in X & even(x) :>

In functional programming, fold refers to a family of higher-order functions that analyze a recursive data structure and through use of a given combining operation, recombine the results of recursively processing its constituent parts, building up a return value. Typically, a fold is presented with a combining function, a top node of a data structure, and possibly some default values to be used under certain conditions. The fold then proceeds to combine elements of the data structure's hierarchy, using the function in a systematic way.

Rodney Martineau "Rod" Burstall FRSE is a British computer scientist and one of four founders of the Laboratory for Foundations of Computer Science at the University of Edinburgh.

Orwell is a small, lazy-evaluation functional programming language implemented principally by Martin Raskovsky and first released in 1984 by Philip Wadler during his time as a Research Fellow in the Programming Research Group, part of the Oxford University Computing Laboratory. Developed as a free alternative to Miranda, it was a forerunner of Haskell and was one of the first programming languages to support list comprehensions and pattern matching.

The Omega interpreter is a strict pure functional programming interpreter similar to the Hugs Haskell interpreter. The syntax closely resembles that of Haskell but with important differences:

Haskell is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research, and industrial applications, Haskell has pioneered a number of programming language features such as type classes, which enable type-safe operator overloading, and monadic input/output (IO). It is named after logician Haskell Curry. Haskell's main implementation is the Glasgow Haskell Compiler (GHC).

<span class="mw-page-title-main">PureScript</span> Strongly-typed language that compiles to JavaScript

PureScript is a strongly-typed, purely-functional programming language that transpiles to JavaScript, C++11, Erlang, and Go. It can be used to develop web applications, server side apps, and also desktop applications with use of Electron or via C++11 and Go compilers with suitable libraries. Its syntax is mostly comparable to that of Haskell. In addition, it introduces row polymorphism and extensible records. Also, contrary to Haskell, the PureScript language is defined as having a strict evaluation strategy, although there are non-conforming back ends which implement a lazy evaluation strategy.

<span class="mw-page-title-main">John Darlington</span> British academic and author

John Darlington is a British academic, researcher and author. He is an Emeritus Professor at Imperial College London. He was Director of the London e-Science Centre and was head of the Functional Programming and Social Computing Sections at Imperial.

References

  1. Burstall R.M, MacQueen D.B, Sannella D.T. (1980) Hope: An Experimental Applicative Language. Conference Record of the 1980 LISP Conference, Stanford University, pp. 136-143.
  2. Bailey, Roger (1 April 1990). Functional Programming with Hope. Ellis Horwood Series in Computers and Their Applications. Ellis Horwood Ltd.
  3. R.M. Burstall. Design considerations for a functional programming language. Invited paper, Proc. Infotech State of the Art Conf. “The Software Revolution”, Copenhagen, 45–57 (1977)
  4. R.M. Burstall and J. Darlington. A transformation system for developing recursive programs. Journal of the Association for Computing Machinery, 24(1):44–67 (1977)
  5. Hudak, Paul; Hughes, John; Peyton Jones, Simon; Wadler, Philip (2007-06-09). A history of Haskell: being lazy with class. ACM. pp. 12–1. doi:10.1145/1238844.1238856. ISBN   9781595937667. S2CID   52847907.
  6. 1 2 Bailey, Roger (August 1985). "A Hope Tutorial". BYTE . Vol. 10, no. 8. Retrieved 1 April 2015.
  7. John Kewley and Kevin Glynn. Evaluation Annotations for Hope+. In Kei Davis and R. J. M. Hughes, editors, Functional Programming: Proceedings of the 1989 Glasgow Workshop, Workshops in Computing, pages 329-337, London, UK, 1990. Springer-Verlag.