Partial Application - Spicery/Nutmeg GitHub Wiki

This feature is a convenient shorthand for writing lambda expressions. The idea is that f$( ??, k ) is a shorthand for fn x: f( x, k ) endfn and that $( ?? < 0 ) is a shorthand for fn x: x < 0 endfn.

The rules for translation is that the entire expression is translated into a lambda expression and all 'holes', denoted by a double-query ??, are turned into parameters of the lambda. For example:

foo$( bar( ?? ), gort( ?? ) )

becomes

fn x, y: foo( bar( x ), gort( y ) ) endfn

This notation is a generalisation of Pop11's partial application. The key difference is that it can be used on any positional arguments, not just the last arguments, and can even substitute inside nested expressions. It is intended for relatively short expressions only, although nothing actively prevents the use on on large expressions (except common sense).


Footnote: In general the $ symbol is reserved for denoting some kind of interpolation.