[Haskell-cafe] Re: Curried function terminology
jon.fairbairn at cl.cam.ac.uk
Mon Oct 5 05:52:17 EDT 2009
michael rice <nowgate at yahoo.com> writes:
> This is from Learn You A Haskell:
> "Curried functions
> Every function in Haskell officially only takes one
> parameter. So how is it possible that we defined and used
> several functions that take more than one parameter so far?
> Well, it's a clever trick! All the functions that accepted
> several parameters so far have been curried functions. What
> does that mean? You'll understand it best on an example.
> Let's take our good friend, the max function. It looks like
> it takes two parameters and returns the one that's bigger.
> Doing max 4 5 first creates a function that takes a
> parameter and returns either 4 or that parameter, depending
> on which is bigger. Then, 5 IS APPLIED TO THAT FUNCTION and
> that function produces our desired result.
> What really happens when we do multThree 3 5 9 or
> ((multThree 3) 5) 9? First, 3 is applied to multThree,
> because they're separated by a space. That creates a
> function that takes one parameter and returns a function. So
> then 5 IS APPLIED TO THAT, which creates a function that
> will take a parameter and multiply it by 15. 9 IS APPLIED TO
> THAT FUNCTION and the result is 135 or something."
> The language (in CAPS) in the above two paragraphs seems to
> be backwards.
It is. "5 is applied to that function" should be "5 is supplied to that
function" (or that function is applied to 5) and so on. It's a fairly
common error in writing this sort of thing¹, and given that the title
"Learn You A Haskell" is totally ungrammatical, hardly seems surprising.
> In the first paragraph, since functions are
> conventionally "applied" to parameters shouldn't it read
> something like THE PARTIALLY APPLIED FUNCTION IS THEN
> APPLIED TO the 5? Or is the terminology different for
No, but Haskell does have a lot of non-native users of English among its
 A pet peeve of mine is "x supports y" being used backwards (as in
"our application supports windows Vista", which would only make sense if
it were something like a system tool that stopped Vista crashing.
Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2009-01-31)
More information about the Haskell-Cafe