membertype
test a data structure, function, or module for a given type
Calling Sequence
Parameters
Description
Examples
Compatibility
membertype(x, s, 'p')
x
-
type
s
set, list, table, function, rtable, sum, product or module
'p'
(optional) an unevaluated name
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. Position is determined as the index in the case of an rtable or module, and ith operand in the case of other data-structures.
Check whether either of the following sets contains an integer.
membertype⁡integer,7,3.2,12
true
membertype⁡integer,3.2,12
false
Check whether any of the three elements of this list is a product.
membertype⁡`*`,x⁢y,w+u,y,k
k
1
Check whether this unevaluated function call has a symbol among its operands.
membertype⁡symbol,f⁡1,a,x,k
3
Search the exports of this module for one assigned to an integer.
m ≔ module_export⁡e,f,g;e ≔ 4end module:
membertype⁡integer,m,p
eval⁡p,1,p
e,4
The membertype command was updated in Maple 2023.
See Also
has
hastype
member
Download Help Document