3 ms·
Why do we need yet another term for concepts already known as function composition, currying, and partial application?
by dreamcompiler 9y ago
Why do we need yet another term for concepts already known as function composition, currying, and partial application?
- Deestan 9y agoIt's not a new term, is the partial answer. The rest is that "point free" describes a programming paradigm, while terms you listed describe the mechanisms you can use to apply it.
- SomeStupidPoint 9y agoIt comes out of the mathematical notion of a point and what not, right? Something, something, only discussing the composition of maps without ever talking about how the initial categories are tied to points. Category theory always makes for weird names for programming features.
- rocqua 9y agoPoint free notation often depends on currying, but it is not the same. Instead, point free notation is about only using composition and currying to define your functions.
- mrkgnao 9y agoPointfree 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".
- lr4444lr 9y agoPointfree 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.
- mrkgnao 9y agoThanks! I'd say at least some of the blame for that is due to how C-family languages make these concepts appear somewhat ... opaque.
- KirinDave 9y agoYou're actually using the wrong words here too. When you take a function and map it to this style, that's called "η-conversion" (pronounced "eta" or "eee-ta"). "Point free style" is the name for the results of writing code where you do not introduce many new variables. You lean on function composition, currying, and often times this style benefits from partial application (famously with (.) and (.).(.) and others, but in general even with folds and traversals). It's not really a problem to introduce a description for the style?
- dreamcompiler 9y agoThanks everybody. It's a much simpler idea than I thought: "Don't introduce extra arguments in your function defs when you don't need to." This is what I always did as a Forth programmer; I just didn't know it had a name.