define function with arbitrary number of arguments
Subject: define function with arbitrary number of arguments
From: Stavros Macrakis
Date: Thu, 8 Jul 2004 18:55:43 -0400
> Is there a way to define something taking an arbitrary number
> of arguments, like Common Lisp's &rest parameters?
As documented in the Function Definition / Function section of the
manual:
>>>>>>>>
You may also define a function with a variable number of arguments,
by having a final argument which is assigned to a list of the extra
arguments:
(C8) f([u]):=u;
(C9) f(1,2,3,4);
(D9) [1, 2, 3, 4]
(C11) f(a,b,[u]):=[a,b,u];
(C12) f(1,2,3,4,5,6);
(D12) [1, 2, [3, 4, 5, 6]]
<<<<<<<<