News for hackers. Stuff that matters.
Re:Partial functions and total functions by 0atman on Tuesday December 14, 2021 @04:48AM (#29549938)
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

Re:Partial functions and total functions by detaro on Tuesday December 14, 2021 @04:53AM (#29549973)
"Partial functions" as used in the article is a pure mathematics term. "partial application" is what I'd call your example.
Re:Partial functions and total functions by i_hate_pigeons on Tuesday December 14, 2021 @05:22AM (#29550160)
I mean he explains what partial functions in his context are in the very first paragraph, not sure how that can be any less confusing!
Re:Partial functions and total functions by srean on Tuesday December 14, 2021 @04:51AM (#29549961)
That'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

Re:Partial functions and total functions by Akronymus on Tuesday December 14, 2021 @05:38AM (#29550238)
> 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)

Re:Partial functions and total functions by srean on Tuesday December 14, 2021 @09:55AM (#29552168)
> 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

Re:Partial functions and total functions by Akronymus on Tuesday December 14, 2021 @10:15AM (#29552411)
It 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.
Re:Partial functions and total functions by creata on Tuesday December 14, 2021 @08:20AM (#29551172)
Off-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 (```).
Re:Partial functions and total functions by 0atman on Wednesday December 15, 2021 @03:22AM (#29563305)
Ah! Partial application != partial functions. Thanks all!
Re:Partial functions and total functions by cjfd on Tuesday December 14, 2021 @05:49AM (#29550298)
Well, 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.