Bill Allombert on Tue, 25 Mar 2014 17:40:48 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

variadic GP functions


Dear developers,

I have merged y branch which allow to define GP functions that take an
unlimited number of argument.

The syntax is as follow:
f(a[..])=sum(i=1,#a,a[i]);
declare a GP function that take a variable number of arguments and return
their sums:
? f(1,2,3)
%2 = 6;
the variable a evaluates to the vector of the argument.

It is possible to add extra argument at the start:
g(s,a[..])=s*sum(i=1,#a,a[i]);
? g(2,3,4)
%4 = 14

Cheers,
Bill