4 ms·
I think, just like any other syntactic sugar, it's fine if used with proper understanding of possible consequences. I'd like to see lisp use indention instead o
by AUmrysh 13y ago
I think, just like any other syntactic sugar, it's fine if used with proper understanding of possible consequences. I'd like to see lisp use indention instead of parens like Python. I'm sure someone's done it and it isn't popular for some reason or another, but I think getting rid of the parens would go a long way to making people stop hating LISP.
- blueblob 13y agoI don't see how lisp could get rid of parends with indentation. Parends are used for function calls so you would then have to indent one extra level to call a function? If there was a workaround for the function calls, then it would also require every function to be written on a separate line, there would be no concept of a one liner.
- dllthomas 13y agoBuilding a tree with indentation is easy. You would need some method to distinguish between a one element list and a value, and some method of specifying an empty list (though you could just write nil). One option that leaves everything completely uniform is to use something that says "this starts a list", and then have the (zero or more) elements indented including the list head if present. If we use (), this would read like: () prin1 () * () + 3 4 7 Exceedingly vertical, obviously, if you don't allow inline parens at all. If you were, you could compress any run of lines by simply moving everything with no children into the parent parens. Applying that only to the deepest bit of the above, we'd get: () prin1 () * (+ 3 4) 7 Of course, the original could be transformed into actual lisp by simply moving end-parens: ( prin1 ( * ( + 3 4 ) 7 ) )
- sparkie 13y agoIndeed. A workaround would be to introduce some infix operators (there are various lisps that do so), so you could use something like '$' for function application and end up with a syntax like Haskell. Of course, this is a terrible idea and very un-lispy, because one of the key benefits of lisp is that it's simple to parse. Introducing infix operators destroys that simplicity. Another workaround, which I quite like, is to simply remove all the "lisp syntax" entirely, and edit a tree directly using a syntax directed editor.
- hajile 13y agoSome people have played with this idea http://readable.sourceforge.net/ http://readable.sourceforge.net/ http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/m-expression/ http://www.informatimago.com/develop/lisp/com/informatimago/... In fact (if you didn't know) lisp M-expressions using whitespace and indentation existed long before python (though the original M-expression syntax idea was based on FORTRAN). The reason M-expressions aren't used in place of S-expressions is because people using lisp preferred and continue to prefer S-expressions.