Hacker News new | past | comments | ask | show | jobs | submit login

Pointfree style uses composition (among other operators), currying, and partially applied functions, but it refers to something distinct from the sum of those concepts/features.

Consider the following function of two parameters, written in Haskell/PureScript syntax:

   f x y =  g x (m (h y))
         = (g x . m . h) y
We can now eta-reduce/partially apply f instead in the definition (which is possible because f is curried by default):

   f x   = g x . m . h
If I were using pointfree style at all (which I almost never do), this is where I'd stop. However, you can go the whole hog and strip out all the arguments:

         = g x . (m . h)
         = ((. (m . h)) . g) x

   f     = (. (m . h)) . g
I've made use of everything you listed, but it's only when you go this far that your function is truly free of "points".



Pointfree style uses composition (among other operators), currying, and partially applied functions, but it refers to something distinct from the sum of those concepts/features

Exactly. But in all fairness to the parent comment to yours, the original article doesn't convey this as well as you lucidly did, and his confusion is perfectly understandable.


Thanks! I'd say at least some of the blame for that is due to how C-family languages make these concepts appear somewhat ... opaque.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: