Calling one function with a variable number of parameters from another function.



? apply
On Aug 1, 2011 8:56 PM, "Bernard Hurley" <bernard at marcade.biz> wrote:
> 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.
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima