Earlier quoted context omitted.
If you have a function `foo(a, b, c)` and you find yourself passing the same a and b all the time, you can curry it into a function that only takes c: `f = curry(foo, a, b)` such that you can just call `f(c)`. The OO alternative would be to create a class: class Foo: def __init__(self, a, b): self.a = a self.b = b def f(c): return foo(self.a, self.b, c) And then you create an instance `obj = Foo(a, b)` and when you n…
Ah I see, I believe you've mixed up currying with partial function application, that's what confused me (but, again, I'm not an expert on functional languages so it could be me that's mixed up). I believe that currying doesn't take any arguments except the function itself: # Signature of f is (a, b, c) -> r g = curry(f) # Signature of g is a -> (b -> (c -> r)) # i.e. g is a -> blah, # where blah itself is a function…
> I suppose the real major thing is you've put a bunch of parameters into a single class/tuple/struct rather than spelling them out individually
Yes, this is the mechanic, ultimately. Partial application vs structs/objects/tuples are just two different solutions for the same problem. Arguably they may even reduce down to the same underlying solution (to the extent that closures are objects behind the scenes).