4 ms·
That's... not my understanding of partial functions. I thought partial functions are functions where you don't supply all the arguments, so the return value is
by 0atman 5y ago
That's... not my understanding of partial functions.
I thought partial functions are functions where you don't supply all the arguments, so the return value is a new function that is ready to accept the missing arguments.
```pseudocode
add(1, 2)
> 3
addtwo = add(2)
addtwo(3)
> 5
```
I'm certainly wrong because John D. Cook uses a lot of big words that I don't understand. CONFUSING
- srean 5y agoThat's called Currying. The Add function isn't partial, it has been partially applied, so its the application of the function that maybe called partial. Different communities using the same word to mean different things is a problem. Especially so, if one isn't aware of it. Another overly abused and overloaded word is functor
- Akronymus 5y ago> That's called Currying. Actually no. Currying is converting one function with multiple arguments to a series of functions with one each. Partial application is supplying some of those arguments and getting back a series of functions that take more arguments. So, currying = f(x,y,z) -> f'(x)(y)(z) While partial application = f(x)(y)(z) + x and y being supplied -> f'(z)
- srean 5y ago> Actually no. Currying is converting one function with multiple arguments to a series of functions with one each It looked to me that exactly what he was doing, turning the function Add that takes to arguments to a series of two functions that takes one
- Akronymus 5y agoIt seems I misinterpreted your comment then. I thought you were talking about the applying part as currying, which is really common. So I kinda short circuited my reasoning and instantly went for the UMM AKTSCHUALLY.
- detaro 5y ago"Partial functions" as used in the article is a pure mathematics term. "partial application" is what I'd call your example.
- i_hate_pigeons 5y agoI mean he explains what partial functions in his context are in the very first paragraph, not sure how that can be any less confusing!
- cjfd 5y agoWell, you do not seem to know all of the meanings of the word 'partial functions'. If one types in 'partial function' in google one can see both the meaning 'partial function' that you have in mind and the meaning of 'partial function' that the article talks about on the first result page. In fact, the 'partial function' of the article appears as the first result. 'CONFUSING' says more about you than about the article.
- creata 5y agoOff-topic: if you want to post a block of code here, I think your best bet is to indent it with four spaces, instead of using code fences (```).
- 0atman 5y agoAh! Partial application != partial functions. Thanks all!