title: How can I define the ":" range operator for my own compound type in Julia?
body: <p>I have the following type definition:    </p>
  
  <pre><code>type TransitionMatrix
    A :: SparseMatrixCSC{Float64,Int64}
    d :: Array{Float64,1}
    I :: Array{Int64}
  end
  </code></pre>
  
  <p>and would like to allow for the following: if we have T :: TransitionMatrix, I'd like the range functionality (IE, P[:, 1], P[:, 3], etc.) to work at it would for T.A. How can I do this? I have done similar things to define the "size" of a transition matrix as below, but I don't know how to allow the colon operator to function how i'd like. Thank you! </p>
  
  <pre><code>function Base.size(T :: TransitionMatrix, dim)
    return size(T.A, dim)
  end
  </code></pre>