Is there a way to check if a given DataType is an abstract type? I've come
up with a crude method below but thought there should be a better way.
function isabstract(t::DataType)
try
t()
catch exception
return (typeof(exception) == ErrorException
A quick search turns up isleaftype, which seems to do exactly the opposite
of what you want:
isleaftype(AbstractArray) = false
isleaftype(Array{Int, 2}) = true
Hope that helps.
On 21 May 2014 20:15, Stephen Chisholm sbchish...@gmail.com wrote:
Is there a way to check if a given DataType is
That's it. Thanks!
On Wednesday, 21 May 2014 16:21:48 UTC-3, Mike Innes wrote:
A quick search turns up isleaftype, which seems to do exactly the
opposite of what you want:
isleaftype(AbstractArray) = false
isleaftype(Array{Int, 2}) = true
Hope that helps.
On 21 May 2014 20:15,