
nops - number of operands in an expression

Calling sequence:
nops(expr)

Parameter:

expr   --  expression

Overloading:

all

Summary:

nops returns the number of operands in the expression expr. nops can be
overloaded but the function used for overloading must return an integer. In
contrast to most other functions, arguments which are expression sequences,
are not flattened. nops is a kernel function.

>>  nops(a*b+3*c+d^2);

     3

>>  nops({a,b,c,d});

     4

>>  a:=[3,4,5,8]: nops(a);

      4

>>  nops(f(3*x,4,y+2));

      3

>>  nops(g());

      0

>>  a:=x,y: b:= s,t: f(a,b), nops(a); nops(a,b);

      f(x,y,s,t), 2
      Error: Wrong number of parameters in function call [nops]

See also:  op, subsop

