[julia-users] function isabstract(::DataType)

2014-05-21 Thread Stephen Chisholm
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

Re: [julia-users] function isabstract(::DataType)

2014-05-21 Thread Mike Innes
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

Re: [julia-users] function isabstract(::DataType)

2014-05-21 Thread Stephen Chisholm
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,