Number of Arguments

Suppose you want to build a function that can accept any number of arguments. You do this by defining a function like this:

f(x,y,...):=sum(arguments)

This function accepts two or more arguments. Because the arguments x and y are explicitly defined, the function must be called with at least 2 arguments. Furthermore, you can refer to the first two arguments in the function body by using the variable names x and y.

However, to refer to the remaining arguments, you need to use one of the following primitives:

Argument Primitives

Primitive Description
arguments Returns a list containing all of the input argument values See arguments.
argval Returns a specific argument value (for example, argval(3) is the third argument) See argval.