I was wondering about the origins of the "let" used in Lisp, Clojure, and Haskell. Does anyone know which language it appeared in first?
Well, BASIC had 'LET' for assignment as part of the syntax from the start in 1964, so that would predate the use of 'let' in Lisp, which as Chris Jester-Young points out didn't appear until the 1970s according to Evolution of Lisp.
I don't believe COBOL, Fortran, or ALGOL have 'LET' in their syntax either. So I'm going to go with BASIC.
I'd like to add a theoretical point of view: In classical lambda calculi,
can be rewritten simply as
So its first appearance in early (functional) languages isn't that interesting.
However, it become very important with the invention of Hindley-Milner type system and its type inference algorithm. In this type system
However, we can't rewrite it using λ abstraction and application. Expression
doesn't type-check, because within the first λ abstraction
You can try this yourself in Haskell. While
Lisp is the oldest language of these having LET. But BASIC was the first that got it, for Lisp had obtained it much later.
In Ada Lovelace Analytical Engine (1843) - no LET, a program looks as:
In Plankalkül of Zuse (1943-45) the program looks:
Short Code was proposed by John Mauchly in 1949
Intermediate PL of Burks, 1950, used for assignment
Rutishauser in 1952 used
Böhms compiler, 1952, used
At the University of Manchester, Alick Glennie developed
Charles Adams, FORTRAN 0 of Backus's group , Brooker's Autocode 2, ПП1 of Lubimsky and Kamynin; all in 1954, again
BACAIC (Grems, Porter), 1954,
Kompiler, ADES, 1955,
AT-3 (1956), Math-Matic (1957), again
but Flow-Matic in 1957 had two assignments, and both are in words
Bauer and Samelson's machine, 1957:
Sorry, I can't cover all languages between 1957 and 1964, but greater languages
have not LET for assignment. Or had not, in the case of LISP.
Dartmouth BASIC is the original version of the BASIC programming language. The first interactive version was made available to general users in June 1964;
Well, between those three, Lisp definitely had it first. Haskell came about in the 80s, and Clojure in the 00s, and
As to whether Lisp was the language to have invented it, I can't vouch for that yet, but I'll do some research and see. :-)
Update: According to Evolution of Lisp (see page 46), it mentioned that
Still doesn't quite answer whether it was invented in another language earlier, of course, but still another data point. :-)
The first Revised Scheme report AIM-452 from January 1978 has
note that Lisp used earlier a different construct
would have been written earlier approximately as