## `extnops` -- the number of operands of a domain element

#### Introduction

`extnops``(object)` returns the number of operands of the object's internal representation.

#### Call(s)

`extnops(object)`

#### Parameters

`object` | - | an arbitrary MuPAD object

#### Returns

a nonnegative integer.

#### Related Functions

`DOM_DOMAIN`, `extop`, `extsubsop`, `new`, `nops`, `op`, `subsop`

#### Details

- For objects of a basic data type such as expressions, sets, lists, tables, arrays etc., `extnops` yields the same result as the function `nops`. The only difference to the function `nops` is that `extnops` cannot be overloaded by domains implemented in the MuPAD language.
- Internally, a domain element may consist of an arbitrary number of data objects; `extnops` returns the actual number of internal operands. Since every domain should provide interface methods, `extnops` should only be used from inside these methods. ``From the outside'', the function `nops` should be used.
- `extnops` is a function of the system kernel.

#### Example 1

`extnops` returns the number of entries of a domain element:

    >> d := newDomain("demo"): e := new(d, 1, 2, 3, 4): extnops(e)

                                         4

    >> delete d, e:

#### Example 2

For kernel domains, `extnops` is equivalent to `nops`:

    >> extnops([1, 2, 3, 4]), nops([1, 2, 3, 4])

                                       4, 4

#### Example 3

We define a domain of lists. Its internal representation is a single object (a list of kernel type `DOM_LIST`):

    >> myList := newDomain("lists"):
       myList::new := proc(l : DOM_LIST) begin new(myList, l) end_proc:

We want the functionality of `nops` for this domain to be the same as for the kernel type `DOM_LIST`. To achieve this, we overload the function `nops`. The internal list is accessed via `extop(l, 1)`:

    >> myList::nops := l -> nops(extop(l, 1)):

We create an element of this domain:

    >> mylist := myList([1, 2, 3])

                               new(lists, [1, 2, 3])

Since `nops` was overloaded, `extnops` provides the only way of determining the number of operands of the internal representation of `mylist`. In contrast to `nops`, `extnops` always returns 1, because the internal representation consists of exactly one list:

    >> nops(mylist), extnops(mylist)

                                       3, 1

    >> delete myList, mylist:

#### Changes

- `extnops` now works on elements of kernel domains.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000