4 ms·
this is really cool. it makes a lot of sense to me (never touched Scala)
by RodericDay 13y ago
this is really cool. it makes a lot of sense to me (never touched Scala)
- draegtun 13y agoSmalltalk, Self, Ruby, Io and (i think) Perl6 are examples of other languages that also do this.
- hesselink 13y agoHaskell also has first-class operators. Operators are infix, surrounding them with parentheses makes them prefix: (+) 1 2. Functions are prefix, surrounding them with backticks makes them infix: 1 `plus` 2. You can define your own, and define precedence and left/right associativity.
- TazeTSchnitzel 13y agoAlso, all methods are curried by default, meaning you can do this: map (*2) [1,2,3,4,5] :)
- draegtun 13y agoRebol is similar where it turns its (pre-defined) infix operators into function calls. For eg. 1 + 1 is transformed into... add 1 1