Languages Features Creators CSV Resources Challenges Add Language
GitHub icon

HOPE

HOPE - Programming language

< >

HOPE is a programming language created in 1978.

#485on PLDB 45Years Old 145Users
0Books 0Papers

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. Read more on Wikipedia...


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

Keywords in HOPE

and or not char num div mod dec X # : -> ; --- if then else > <= + ( ) , infix - truval :: nil " <> == in where data ++ lambda

Language features

Feature Supported Token Example
Conditionals ✓
Comments ✓
--- A comment
Line Comments ✓ ---
--- A comment
Single-Type Arrays ✓
[1,2,3]
Letter-first Identifiers ✓
Anonymous Functions ✓
lambda(x,y) => x + y
Integers ✓
Infix Notation ✓
max(10,20) + max(1,max(2,3));
Pattern Matching ✓
Merges Whitespace ✓
hasUserDefinedOperators ✓
Hope enables us to use a function with two arguments as an infix operator. e must assign it a priority and use it as an infix operator everywhere, including the equations that define it. A bigger number in the infix declaration means a higher priority. Most of Hope's standard functions are supplied as infix operators.
infix mult 8;
dec mult : num # num - > num;
---xmulty<= ifY=0then0elsexmult(y-1)+x;
Semantic Indentation X
While Loops X
imba.html · hope.html · asmjs.html

View source

- Build the next great programming language · Search · Day 213 · About · Blog · Acknowledgements · Traffic · Traffic Today · GitHub · feedback@pldb.com