Le mardi 09 février 2016 à 12:24 -0800, Jeffrey Sarnoff a écrit :
> Any advice on quick 'n EZ coding of something like these?
> 
> allsupertypes(Irrational) == ( Real, Number, Any )
> 
> allsubtypes(Integer) == ( BigInt, Bool,  Signed, 
> Int128,Int16,Int32,Int64,Int8, Unsigned, UInt128,UInt16,UInt32,UInt64,UInt8 )
> abstractsubtypes(Integer) == ( Signed, Unsigned )
> concretesubtypes(Integer) == ( 
> BigInt,Bool,UInt128,UInt16,UInt32,UInt64,UInt8,UInt16,UInt32,UInt64,UInt8)
Here's a way to get all concretes ubtypes:
subtypestree(x) = length(subtypes(x)) > 1 ? map(subtypestree, subtypes(x)) : x
[subtypestree(AbstractArray)...;]

You should be able to adapt this to return all abstract types instead
by using isleaftype() (which would better be called isconcretetype()?).
But note there's the special case of parametric types, which aren't
leaf types.


Regards

Reply via email to