I'm not exactly sure how to word this question.
I learnt what currying was in the first year of university, and have been using it where applicable ever since.
However, I quite often see on the Internet various complaints that other peoples examples of currying are not currying, but are actually just partial application.
I've not foun...
Can you pass in an operation like "divide by 2" or "subtract 1" using just a partially applied operator, where "add 1" looks like this:
List.map ((+) 1) [1..5];; //equals [2..6]
// instead of having to write: List.map (fun x-> x+1) [1..5]
What's happening is 1 is being applied to (+) as it's first argument, and the list item is being...
Partial application is cool. What functionality does functools.partial offer that you can't get through lambdas?
>>> sum = lambda x, y : x + y
>>> sum(1, 2)
3
>>> incr = lambda y : sum(1, y)
>>> incr(2)
3
>>> def sum2(x, y):
return x + y
>>> incr2 = functools.partial(sum2, 1)
>>> incr2(4)
5
Is functools somehow more efficient, or...