4 ms·
I 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 f
by blueblob 13y ago
I 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.