Previous Page Next Page Contents

Type::Union -- type for testing several types with one call

Introduction

Type::Union(type1, type2...) represents all objects having at least one of the types type1, type2...

Call(s)

testtype(obj, Type::Union(obj_types...))

Parameters

obj - any MuPAD object
obj_types - a sequence of types; a type can be an object of the library Type or one of the possible return values of domtype and type

Returns

see testtype

Related Functions

testtype

Details

Example 1

Check, whether the given object is a positive or negative integer:

>> testtype(2, Type::Union(Type::PosInt, Type::NegInt))
                                   TRUE

x however, is neither a positive nor a negative number:

>> testtype(x, Type::Union(Type::Positive, Type::Negative))
                                   FALSE

Example 2

testtype is used to select positive and negative integers:

>> SET:= {-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2}:
   select(SET, testtype, Type::Union(Type::PosInt, Type::NegInt))
                              {-2, -1, 1, 2}
>> delete SET:

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000