Let's say I have a function foo:
def foo(A, B, C)
A + B + C
end
And I call it like this, with only the last parameter changing:
foo("foo", "bar", "123")
foo("foo", "bar", "456")
foo("foo", "bar", "789")
How can I "bake" or "pre-fill" the arguments that do not change? So maybe I would get a new callable foo_baked
such that foo_baked("123")
is the same as foo("foo", "bar", "123")
?
And use it like this:
foo_baked = ...?
foo_baked("123")
foo_baked("456")
foo_baked("789")
Note that I do not want to define a new function using def
but want to be able to create foo_baked at runtime on the fly, maybe for an array.