Type::Intersection
--
a type representing the intersection of several types
represents all objects having
all of the types Type::Intersection
(type1, type2...)type1, type2...
testtype(obj,
Type::Intersection(
obj_types...)
)
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 |
see testtype
testtype(obj, Type::Intersection(
obj_types...)
)
checks, whether obj
has all the
given types obj_types....testtype(obj, Type::Intersection(
obj_types...)
)
is thus
equivalent to the call _lazy_and(map(obj_types,
x -> testtype(obj, x))
)
, testing obj
against all types in
turn.testtype
).Check, whether the given object is a positive and odd integer:
>> testtype(1, Type::Intersection(Type::PosInt, Type::Odd))
TRUE
2
however, is not a positive and a odd number:
>> testtype(2, Type::Intersection(Type::PosInt, Type::Odd))
FALSE
testtype
is used to select positive
and odd integers:
>> SET:= {-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 3}:
select(SET, testtype, Type::Intersection(Type::PosInt, Type::Odd))
{1, 3}
>> delete SET:
Type::Intersection
is a new functionMuPAD Combinat, an open source algebraic combinatorics package