Inline Functions
Simple operations like additional and multiplication are often represented as functions in functional languages. Many of these operations are implemented in Java as single instructions, and it is far more efficient to execute a single add instruction than to invoke an add function.
JFuncMachine provides a number of inline functions to
perform these operations without doing a method/function call.
The InlineCall expression takes a reference to an inline
function, and an array of expressions containing the
function arguments. Most inline functions like Inlines.IntAdd
take two arguments, but others like Inlines.IntNeg (negate)
take one. The following example multiples two double values
together:
new InlineCall(Inlines.DoubleMul, new Expression[] {
new DoubleValue(6.0), new DoubleValue(7.0)
})