4 ms·
Haskell also has first-class operators. Operators are infix, surrounding them with parentheses makes them prefix: (+) 1 2. Functions are prefix, surrounding the
by hesselink 13y ago
Haskell 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