What is "point free" style (in Functional Programming)?

Paul Hollingsworth picture Paul Hollingsworth · Jun 3, 2009 · Viewed 23.7k times · Source

A phrase that I've noticed recently is the concept of "point free" style...

First, there was this question, and also this one.

Then, I discovered here they mention "Another topic that may be worth discussing is the authors' dislike of point free style."

What is "point free" style? Can someone give a concise explanation? Does it have something to do with "automatic" currying?

To get an idea of my level - I've been teaching myself Scheme, and have written a simple Scheme interpreter... I understand what "implicit" currying is, but I don't know any Haskell or ML.

Answer

Dario picture Dario · Jun 3, 2009

Just look at the Wikipedia article to get your definition:

Tacit programming (point-free programming) is a programming paradigm in which a function definition does not include information regarding its arguments, using combinators and function composition [...] instead of variables.

Haskell example:

Conventional (you specify the arguments explicitly):

sum (x:xs) = x + (sum xs)
sum [] = 0

Point-free (sum doesn't have any explicit arguments - it's just a fold with + starting with 0):

 sum = foldr (+) 0

Or even simpler: Instead of g(x) = f(x), you could just write g = f.

So yes: It's closely related to currying (or operations like function composition).