3 ms·
> Function application uses conventional mathematical notation, e.g. f(a,b) instead of (f a b) as in Haskell. Thank you for that.
by ur-whale 5y ago
> Function application uses conventional mathematical notation, e.g. f(a,b) instead of (f a b) as in Haskell.
Thank you for that.
- zwaps 5y agoI wonder if it were possible to create a language with the power of Haskell, but with a better, more mathematical-like syntax?
- ktpsns 5y agoYou may want to look into Wolfram Mathematica. It has the syntax f[x,y] and a super extensive standard library, being otherwise very LISPy.
- throwaway4good 5y agoWolfram has a wild standard library but as a language it is less than elegant.
- HelloNurse 5y agoI remember a distinctly kitchen sink design style in Mathematica language features about 20 years ago, how did it evolve?
- throwaway4good 5y agoIt seems like it is a trade-off.
- nsytk 5y agoHaskell is more versatile: f(a, b) is a function applied to a single tuple, f a b is a function applied to two arguments. I do not understand the "instead of" in the cited part and it makes me somewhat skeptical (so does the "Py" in the name).
- ModernMech 5y agoIn Haskell, all functions take a single argument.
- HelloNurse 5y agoThis "mandatory" currying is an useful and elegant simplification compared to other languages, but in practical terms if we write f a b f has to work as a function of two arguments; that it is also formally interpretable, but not necessarily useful, as a function of one argument is only a nice bonus.
- faho 5y agoIn python, f(a, b) is a function applied to two arguments and f((a, b)) is a function applied to a single tuple.
- zgamy 5y agoBut is that closer to math notation as claimed in this thread? https://en.wikipedia.org/wiki/Argument_of_a_function https://en.wikipedia.org/wiki/Argument_of_a_function "For example, the binary function f(x, y) = x + y has two arguments, x and y, in an ordered pair (x, y)." So, function application to an ordered pair, i.e., a tuple, does not use double parentheses. Also, of course, currying in Python is atrocious.
- Xophmeister 5y agoThe lack of parentheses for function arguments in Haskell make currying -- one of its key idioms -- very ergonomic.