Knowledge Fusion optional variable arguments

An optional argument ia defined by parenthesis (), and one or many
optional arguments are defined with (three dots).

Example would be to have optional many arguments:

Defun: Average (Number … $nums)

This example if a function called “Average” with optional arguments of
type “Number” that can be one or many stored in a list called “$nums”.

One way to access the $nums is by creating an expression block:

@{
$total << loop {
for $num in $nums;
sum $num;
};

So in Knowledge Fusion it is possible to have a function with optional arguments and it is possible to have a function to allow one or many arguments. The design patterns I try to stick to does not have a need for variable arguments but the optional feature is nice if you can have default values then override if necessary.

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Leave a Reply