Haskellizing python (was Why not use juxtaposition to indicate function application)
rusi
rustompmody at gmail.com
Sat Mar 17 01:26:28 EDT 2012
On Mar 16, 5:45 pm, Ray Song <emacs... at gmail.com> wrote:
> I confess i've indulged in Haskell and found
> f a
> more readable than
> f(a)
>
> And why aren't functions curried (partially applied function is another function which takes the rest arguments) by default?
>
> Thanks in advance for any suggestions.
>
> --
> Ray
In Haskell
a b c d is short for (((a b) c) d)
This works nicely when the latter is commonly required, as for example
happens in a language where what one may call 'the currying
convention' is the default.
It fails when one wants the opposite convention -- a (b (c (d))) --
which may be called the 'function-composition convention.'
The fact that the default convention in haskell is not always a good
idea is seen in the existence of a special application operator $ with
low precedence which allows
a (b (c (d))) to be written as a $ b $ c $ d
It is another matter: as someone pointed out that () is overloaded in
python to denote:
- function application
- tupling
- grouping
Comes from the hegemony of ASCII.
A from-first-principles unicode language would use more of these:
http://xahlee.org/comp/unicode_matching_brackets.html
More information about the Python-list
mailing list