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.
Point free style means that the code doesn't explicitly mention it's arguments, even though they exist and are being used.
This works in Haskell because of the way functions work.
For instance:
returns a function that takes one argument, therefore there is no reason to explicit type the argument unless you just want too.
Point-free style means that the arguments of the function being defined are not explicitly mentioned, that the function is defined through function composition.
If you have two functions, like
and if you want to combine these two functions to one that calculates
x*x+1
, you can define it "point-full" like this:The point-free alternative would be not to talk about the argument
x
:An JavaScript sample:
Reference
Here is one example in TypeScript without any other library:
You can see point-free style is more "fluent" and easier to read.
Just look at the Wikipedia article to get your definition:
Haskell example:
Conventional (you specify the arguments explicitly):
Point-free (
sum
doesn't have any explicit arguments - it's just a fold with+
starting with 0):Or even simpler: Instead of
g(x) = f(x)
, you could just writeg = f
.So yes: It's closely related to currying (or operations like function composition).