3 ms·
What is the connection between OO and infix vs. FP and prefix? Most FP languages use infix notation for operators, and Haskell even supports infix notation for
by nv-vn 11y ago
What is the connection between OO and infix vs. FP and prefix? Most FP languages use infix notation for operators, and Haskell even supports infix notation for all functions. Lisp does both OOP and FP in prefix notation.
- zeckalpha 11y agohttps://en.wikipedia.org/wiki/Word_order https://en.wikipedia.org/wiki/Word_order SVO/OO/Infix: subject.verb(object) VSO/FP/Prefix: (verb subject object) SOV/RPN/StackOriented/Suffix: subject object verb
- nv-vn 11y agoI think in that way it would make sense to say that procedural is also prefix, then, since even very procedural languages like C use VSO. Some OOP languages use VSO too (Perl's indirect object syntax, Common Lisp with CLOS, etc.) And someone could write all their Haskell as: 1 `elem` [1, 2, 3] is a common way of calling elem in Haskell, and many times functions are redefined as operators (such as <$> instead of fmap, that gets used a lot more often). I just think that any kind of split with syntax based on paradigm seems very artificial to make.
- zeckalpha 11y agoThe same is true for natural languages.