test a data structure, function, or module for a given type - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Operations : Sets and lists : membertype

membertype - test a data structure, function, or module for a given type

Calling Sequence

membertype(x, s, 'p')

Parameters

x

-

type

s

-

set, list, table, function, or module

'p'

-

(optional) an unevaluated name

Description

• 

The function membertype determines, the membertype(x, s) function determines if there is an operand within the expression s of type x.  Given a module, it determines if there is an assigned export of type x. If so, it returns true, and false otherwise.

• 

If a third argument 'p' is present and membertype yields true, then the position of the first x in s is assigned to p in the case of sets and lists, whereas the member instance is assigned to the name p if s is a module.

Examples

Check whether either of the following sets contains an integer.

membertypeinteger,12,3.2,7

true

(1)

membertypeinteger,12,3.2

false

(2)

Check whether any of the three elements of this list is a product.

membertype`*`,xy,w+u,y,k

true

(3)

k

1

(4)

Check whether this unevaluated function call has a symbol among its operands.

membertypesymbol,f1,a,x,'k'

true

(5)

k

3

(6)

Search the exports of this module for one assigned to an integer.

m:=moduleexporte,f,g;e:=4end module:

membertypeinteger,m,'p'

true

(7)

evalp,1,p

e,4

(8)

See Also

has, hastype, member


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam