On Mar 10, 2010, at 12:21 PM, Ketil Malde wrote:

Introducing names means that I need to keep the temporary definitions in my
head, and I think "takeWhile (<10000)" is as clear as it can get.  And
while a name can be misleading (belowLimit is a boolean, no?) or flat
out wrong, the definition has its semantics¹.

I agree that composition chains are acceptable (and preferable) if they are clear. And I won't argue about wether the example from LYAHFGG is sufficiently clear in pointfree style (because I'm biased, to me it is certainly clear).

I do not agree that introducing names locally for compositions is *always* a bad idea, even if used only once. (Choosing names that are "misleading or flat out wrong" is of course always a bad idea.)

Named values are just like comments

While you wanted to degrade named values by this statement I think it can serve as justification. A sensible comment for the example program might be

    -- computes the sum of all odd squares below a certain limit

With the names in the rewritten example this comment is no longer necessary. I think only an average Haskell programmer understands the original pointfree program as quickly as this comment.

Good names can help making comments less important.

Sebastian

--
Underestimating the novelty of the future is a time-honored tradition.
(D.G.)



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

Reply via email to