Calling one function with a variable number of parameters from another function.
Subject: Calling one function with a variable number of parameters from another function.
From: Bernard Hurley
Date: Tue, 02 Aug 2011 01:56:06 +0100
Hi,
What is the usual way in Maxima to call one function with a variable
number of parameters when all you have is a list of those parameters? I
came up with the following solution (where f2 calls f1), but I am
interested to know whether there is a better way to do it:
(%i1) f1(m,[L]) := (display (m,L), "done");
(%o1) f1(m, [L]) := (display(m, L), "done")
(%i2) f2([L]) := (buildq([L], f1(1,splice(L))),ev(%%));
(%o2) f2([L]) := (buildq([L], f1(1, splice(L))), ev(%%))
(%i3) f1(2,a,b);
m = 2
L = [a, b]
(%o3) done
(%i4) f2(2,a,b);
m = 1
L = [2, a, b]
(%o4) done
Thanks,
Bernard.