[Haskell-cafe] Re: Curried function terminology

michael rice nowgate at yahoo.com
Mon Oct 5 10:31:08 EDT 2009


Yeah, and Haskell supports Linux, AND Windows. ;-)



Thanks for the explanation. My shorts weren't in a knot; just said Huh?
upon reading it, thinking maybe I misunderstood something along the way.



Michael


--- On Mon, 10/5/09, Jon Fairbairn <jon.fairbairn at cl.cam.ac.uk> wrote:

From: Jon Fairbairn <jon.fairbairn at cl.cam.ac.uk>
Subject: [Haskell-cafe] Re: Curried function terminology
To: haskell-cafe at haskell.org
Date: Monday, October 5, 2009, 5:52 AM

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
> Haskell, 

No, but Haskell does have a lot of non-native users of English among its
users.


[1] 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)

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091005/f140c9df/attachment.html


More information about the Haskell-Cafe mailing list