
contains - tests if an element or index exists

Calling sequence:

contains(container, expr)
contains(list, expr [ , integer) ]

Parameter:
container   --  set, list, array, table, or domain
list        --  list
expr        --  expression
integer     --  integer

Overloading:

1

Summary:

contains tests if the expression expr is contained as an element or respectively
as an index in the container container. The container can be a set, a list,
an array, a tableor a domain .

In a set, according to if the expression is an element of the set or not, one of
the Boolean values TRUE or FALSE is returned.

If a list is tested then instead of the Boolean value the output consists of
the position of the searched for element.  If the element exists more than

once then only the first occurence is taken into account. The description of
the posistion is made with a posistive integer. If the element does not exist
contains returns the value 0.

With the input of a third argument the position in the list from where the
search is to begin can be determined. Entries occuring before this position
are not taken into account.

If the container is an array, a table or a domain then contains returns TRUE
when a value is stored in the index expr. contains is a kernel function.

>>  contains({a, b, c}, a);

      TRUE

>>  contains({a, b, c+d}, c);

      FALSE

>>  contains([a, b, c], b);

      2

>>  contains([a, b, c], d);

      0

>>  contains([a, b, a, b], b, 3);

      4

>>  t := table(13="val"): contains(t, 13), contains(t, "val");

      TRUE, FALSE

See also:  has

