ARGLENGTH INDEX

ARGLENGTH _ _ _ _ _ _ _ _ _ _ _ _ operator

The operator arglength returns the number of arguments of the top-level operator in its argument.

syntax:

arglength(<expression>)

<expression> can be any valid REDUCE algebraic expression.

examples:


arglength(a + b + c + d); 

  4 


arglength(a/b/c); 

  2 


arglength(log(sin(df(r**3*x,x)))); 


  1

In the first example, + is an n-ary operator, so the numb er of terms is returned. In the second example, since / is a binary operator, the argument is actually (a/b)/c, so there are two terms at the top level. In the last example, no matter how deeply the operators are nested, there is still only one argument at the top level.