3 ms·
I feel like the syntax could do with bit more explanation. For example in "(* ) + (* )" the use of parenthesis is not explained anywhere as far as I can tell. A
by zokier 9y ago
I feel like the syntax could do with bit more explanation. For example in "(* ) + (* )" the use of parenthesis is not explained anywhere as far as I can tell. Also, shouldn't it be "(* ) `+` (* )" instead if "+" is used as an infix function instead of postfix, i.e. so that the expression desugars into "(* ) ; (* ) +"
- tmerr 9y agoThis is likely borrowed from Haskell where functions starting with special characters are treated as infix. Parens and backticks allow for switching between the conventions add a b = a + b -- these are all the same 3 + 4 (+) 3 4 add 3 4 3 `add` 4 The article might also make slightly more sense in context, I think it was in part an idea for how to make infix notation more useful in Kitten: https://github.com/evincarofautumn/kitten/issues/174 https://github.com/evincarofautumn/kitten/issues/174
- ghusbands 9y agoTo some extent, yes, but the article silently switches the meaning of + about halfway through. That's why there's confusion.
- newen 9y agoLooks like somewhere in the middle he/she switched to a different style. Where +, *, etc are treated as infix operators by default; so that you don't have to write `+` anymore. But to treat + as a regular operator, you would write (+).