5 ms·
timonoko|3 years ago|parent|on: Lisp and Haskell (2015) Common Lisp could evolve into totally parenthesis-free language. By expanding the "powerfull and versat
by timonoko 4y ago
timonoko|3 years ago|parent|on: Lisp and Haskell (2015)
Common Lisp could evolve into totally parenthesis-free language. By expanding the "powerfull and versatile" Loop-macro into full powerfullness and versatileness. Unfortunately two parenthessis needed, but you can redefine the language having those by default around every file.
- dang 4y agoIf you're going to quote an old comment, please link to it as well: https://news.ycombinator.com/item?id=24716449 https://news.ycombinator.com/item?id=24716449.
- vaylian 4y agoAfter having grokked Lisp, I think that parentheses provide a more elegant solution to the problem of parameter separation. Compare: myfunction(a, b, c) with (myfunction a b c) Parentheses allow you to leave out the commas between arguments. I like that a lot.
- pg_1234 4y agoWhile C syntax requires commas, there's nothing about having the function name outside the parentheses that suddenly forces commas. Theoretically: (myfunction a b c) could be written as: myfunction(a b c)
- bradrn 4y agoML-family languages are similar: ‘myfunction a b c’. It definitely is nice.
- deleted 4y ago[deleted]
- avindroth 4y agoThe consequence of having the AST be explicit is profound.
- thaumasiotes 4y ago> Parentheses allow you to leave out the commas between arguments. You compared the wrong things. The parentheses associated with myfunction aren't doing that. The reason Lisp is better at passing arguments to functions is that it requires you to add parentheses to every function call. The C-style syntax in your first example is trying to let you do this: myfunction(a, a+b, c) In Lisp, you'd do this: (myfunction a (+ a b) c) C has "saved" you the work of putting parentheses around (a+b) at the cost of making you add commas to everything. Here that's a wash because you needed two commas. But C really did save you three spaces that are necessary in the Lisp. (They separate a from myfunction and + from a/b.) You could save two spaces while getting the same benefit of losing the commas if you went with myfunction(a +(a b) c)
- kazinator 4y ago> C has "saved" you the work of putting parentheses around (a+b) at the cost of making you add commas to everything. Not only that but also at the cost of putting a comma which is spelled + between all the terms of a addition: myfunction(a(),b()+c()+d()+e()+f(),g()) (myfunction(a)(+(b)(c)(d)(e)(f))(g))
- msk-lywenn 4y agocould just as well be myfunction(a() +(b() c() d() e() f()) g()) with the condition that there is no space between the symbol and the opening parenthesis
- rileyphone 4y agoI’m working on a syntax for an object oriented lisp-like thats basically this (the self receiver is implied) .myfunction(.a .b.+(.c).+(.d).+(.f) .g) though making binary arithmetic operations singly-dispatched methods of the number class may be a mistake.
- actionfromafar 4y agoYak-shaving away syntax always make me think of Forth. It's all a stack.
- chriswarbo 4y agoHere's my standard response to this topic: http://www.chriswarbo.net/blog/2017-08-29-s_expressions.html http://www.chriswarbo.net/blog/2017-08-29-s_expressions.html tl;dr the parentheses are just the way s-expressions are serialised; there are many existing alternatives, e.g. based on indentation, etc.