Partial function application

Midio functions can take other functions as input by using the top-right socket as illustrated bellow. The Std CallFunctionfunction can be used to call functions passed as input.

When the function being used as input has any inputs set, like the Math Addfunction above, which has its firstinput set to 123, the function acts as a partially applied function.

This means the Math Addfunction above now only takes one input instead of two. This input can either be supplied as an object with the input name as a key, as we do above, or as a list with only one input, like we show below.

Partial function application can be very useful in situations when you needs to be able to pass a function which captures certain data which is only available outside the function.

Partial function application can act as a limited kind of closure in those circumstances.

Last updated

Was this helpful?