3 ms·
To explore ways of bringing Lisp to wider ranges of audiences, I prefer indentation based syntax like: -> range 100 map $ fn (x) * x x
by jiyinyiyong 5y ago
To explore ways of bringing Lisp to wider ranges of audiences, I prefer indentation based syntax like:
->
range 100
map $ fn (x)
* x x
foldl 0 &+
println
which is S-Expressions with indentations, with in-line paren pairs. It looks a lot like Python by still using prefixed operators and it's still S-Expressions after parsing to remain homoiconic.
And my prototype language http://calcit-lang.org/ http://calcit-lang.org/ .
- Syzygies 5y agoI've used something like this for Lisp-family languages privately for decades. [1] I like having a bar | open a parenthesis that closes automatically when the line or group ends. [2] There are many Lisp/Scheme constructions that jump two deep without an intervening symbol. Rather that having to count out indents, it's very helpful and readable to have a dummy symbol as skeleton to reify the parenthesis structure. I like $ from Haskell.
- kazinator 5y agoHaha! The irony; I found your comment in a HN search for Lisp. In the search result, your painstakingly indented code appears flattened to the left margin, destroying the correctness of its structure. https://i.imgur.com/jAB0tBn.png https://i.imgur.com/jAB0tBn.png Just, no.
- jiyinyiyong 5y agoYou are right. When tools are not being friendly to indentation based syntax, the code with indentations would be a mess. Parentheses and curly braces are lot like "defensive programming" against unfriendly tools.