Categories
- Category Theory (4)
- Computer Science (4)
- Economics (4)
- Education (2)
- Ethics (2)
- Evolution (6)
- Functional Programming (3)
- Linguistics (2)
- Mathematics (4)
- Philosophy (4)
- Politics (1)
- Psychology (3)
Category Archives: Linguistics
Infix Order Reversal
In Haskell, given any function with two arguments (curried) we can choose to use it infix position. The syntax for this depends on how we name the function; if we name the function in the form (s)
then s
is the infix form of the function, and otherwise an arbitrary function f
can be converted to infix form by wrapping in backticks, as in `f`
.
In either case, the infix form of the function expects the arguments in a certain order, and the order used in Haskell is:
(s) x y := x s y
I think it would be more natural if the order was the other way around, so:
(s) x y := y s x
Continue reading
Posted in Computer Science, Functional Programming, Linguistics
3 Comments
Grammar is like a Type System
In an analogy between natural language and programming language, grammar can be compared to a type system, which provides a great way to learn about one if you know about the other1. Continue reading