Re: [julia-users] How does the colon actually get parsed in array indexing?

2014-11-13 Thread Isaiah Norton
You can declare a function to take ::Colon as a parameter: julia> f(::Colon) = 1 f (generic function with 1 method) julia> f(:) 1 You could use this to create an overloaded constructor and do something like: TVP(a::Array, ::Colon) = TVP(a, 1:length(a)) Not entirely sure if this is what you are

[julia-users] How does the colon actually get parsed in array indexing?

2014-11-13 Thread Spencer Lyon
I am trying to construct a type with this definition: # are two ranges disjoint? isdisjoint(r1::UnitRange, r2::UnitRange) = isempty(intersect(r1, r2)) # are a collection of ranges all disjoint? function all_disjoint(rs::UnitRange...) n = length(rs) for i=1:n, j=i+1:n if !(isdisj