3 ms·
> John McCarthy didn't implement Lisp in machine code. McCarthy also didn't expect S-expressions to be a concrete form. He expected everybody would write in M
by bsder 10y ago
> John McCarthy didn't implement Lisp in machine code.
McCarthy also didn't expect S-expressions to be a concrete form. He expected everybody would write in M-expressions.
The fact that S-expressions worked as the language itself is again due to Steve Russell's insight.
- kazinator 10y agoThe problem was that M-expressions are just really silly way of spelling S-expressions, almost node for node, atom for atom. Whatever disadvantages we agree S-expressions have, M-expressions have all of them, and then some: like extra noise due to punctuation. What are M-expressions? Basically this: (a b c) (quote (a b c)) car[x] (car x) car[append[(a b c); (d e f)]] (car (append (quote (a b c)) (quote (d e f)))) Parentheses implicitly quote. Square brackets are non-quoting, but the first element goes outside. Inside square brackets, pointlessly superfluous semicolons appear. S-expressions developed the ' notation for quoting, almost eliminating the slight advantage of M-expressions there: (a b c) '(a b c) car[x] (car x) car[append[(a b c); (d e f)]] (car (append '(a b c) '(d e f)))) The apostrophe notation is smarter; I don't see a way in M-exps to quote an individual atom. Though M-exps give us this: (x) (quote (x)) if we want (quote x) it looks as if we have to write: quote[x] 'x whose lameness is self-evident. I think MacCarthy was exploiting M-expressions for the way that most trivial instances of them look different from S-expressions, which was a useful distinction to have in the papers about Lisp. With an M-exp you could whack the reader over the head and say "hey reader, this is character syntax: what you enter into the machine" and then with S-exps you say "this is a textual picture of internal structure". There are other ways for that though, like different fonts, or upper/lower case and whatnot, or some REPL convention where we show the prompt in front of what is typed in, plus the "result arrow" and such.
- eschaton 10y agoAnother interesting aspect of M-expressions is how much like Mathematica/Wolfram they look.
- ericbb 10y agoI think that M-expressions are quite interesting but I'll just make a few concrete points here. > if we want (quote x) it looks as if we have to write: ... quote[x] I think that you could just write X in that case. Uppercase text was for symbolic atoms. Also, you didn't mention conditionals: M-expressions: ff[x] = [atom[x] → x; T → ff[car[x]]] S-expressions: (defun ff (x) (cond ((atom x) x) (T (ff (car x))))) The semicolon and the infix arrow have the benefit of reducing the need for parentheses in that case. And you can avoid writing "defun" and "cond".
- abecedarius 10y agoIIRC in M-expressions, uppercase meant an atom. You'd write X instead of quote[x]. QUOTE was introduced only for the eval function working on the S-expression form.