We need to do the opposite of currying
josephcsible opened this issue · 2 comments
Currently, we perform currying, where if you call a function with less arguments than it needs, it gets partially applied. We need to do the opposite of that as well, where if you call a function with too many arguments, the remaining ones get passed to the function's output, transforming f(a, b) to (f(a))(b) for example.
Here's a concrete case that doesn't work as expected:
- Create variable cards with the number 3, the Increment operator, and the Identity operator.
- Go to Flip in the logic programmer, put in Identity, and get the resulting card (I'll call it "CI").
- Go to Apply 2 in the logic programmer, put in CI, 3, and Increment, and get the resulting card.
- Put that card in a display panel.
The expected result is the number 4, but instead you get an error: "The given config render pattern with 2 slots is not compatible with the number of input types 1 for :flip".
Here's what I expect to happen, written in combinatory logic style:
- Flip Identity 3 Increment
- Apply beta reduction to Flip (λxyz.xzy):
- Identity Increment 3
- Apply beta reduction to Identity (λx.x):
- Increment 3
- Evaluate the Increment operator:
- 4
(Edit: In fact, you get the error much sooner by just attempting to materialize CI.)
Ok, I understand the problem. This is indeed something I did not take into account while implementing currying. But AFAICS, it should be possible to implement this in the current system without any major changes nonetheless.