5 ms·
Lisp syntax is quite a bit more than prefix operators + postfix arguments. * s-expressions are a syntax for data * Lisp syntax is expressed on top of s-expres
by lispm 12y ago
Lisp syntax is quite a bit more than prefix operators + postfix arguments.
* s-expressions are a syntax for data
* Lisp syntax is expressed on top of s-expressions, reusing s-expression syntax for data
* Lisp has built-in syntax for several constructs: lambda, let, block, setq, if, ...
Many programming languages have some form of prefix operators.
Btw., some Lisps allow to omit outer parentheses in a Listener (aka REPL):
CL-USER 30 > delete-file "/Lisp/foo"
NIL
- arethuza 12y agoSpeaking of leaving parentheses out of lisp - you can go the whole way and have a whitespace lisp: http://draketo.de/light/english/wisp-lisp-indentation-preprocessor http://draketo.de/light/english/wisp-lisp-indentation-prepro...
- lispm 12y agoStuff like that exists for decades: For example RLISP: SYMBOLIC PROCEDURE SMEMBER(U,V); %determines if S-expression U is a member of V at any level; IF U=V THEN T ELSE IF ATOM V THEN NIL ELSE SMEMBER(U,CAR V) OR SMEMBER(U,CDR V); Which would be in Lisp: (defun smember (u v) "determines if S-expression U is a member of V at any level" (cond ((equal u v) t) ((atom v) nil) (t (or (smember u (car v)) (smember u (cdr v)))))) RLISP has been developed somewhere in the 60s/70s as a parentheses free notation for Lisp on top of Standard Lisp. Much of the computer algebra system REDUCE is written in RLISP.
- qu4z-2 12y agoThis strikes me as a much bigger and less obvious transformation than the one suggested by the grand-parent (although interesting none-the-less). Specifically, this seems to take semantics into account whereas the suggested representation is apparently purely syntactic. For instance, the transformation from IF U=V THEN T into (cond ((equal u v) t)) would seem to require an understanding of the IF construct and a mapping of infix operators to lisp functions at the least. Now, maybe this syntactic transformation has been around for decades too (the fact that I've independently toyed with the same idea suggests it's not uncommon to play with), and alternative Lisp syntaxes are quite interesting in their own right, but I do feel that the whitespace-lisp suggestion has merit in its own right (but again, I'm clearly biased). Essentially, it's an alternate syntax for s-expressions, not lisp.
- taeric 12y agoThis is directly addressed in the article. The main point was simply that prefix notation for all things isn't that confusing. In fact, the main place it is somewhat confusing is with the math operators.