Skip to content

Commit

Permalink
allow some more cases of tuple indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Dec 30, 2012
1 parent b557388 commit 66ae77a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions base/tuple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
length(t::Tuple) = tuplelen(t)
size(t::Tuple, d) = d==1 ? tuplelen(t) : error("invalid tuple dimension")
ref(t::Tuple, i::Int) = tupleref(t, i)
ref(t::Tuple, i::Integer) = tupleref(t, int(i))
ref(t::Tuple, r::Ranges) = tuple([t[ri] for ri in r]...)
ref(t::Tuple, i::Real) = tupleref(t, convert(Int, i))
ref(t::Tuple, r::AbstractArray) = tuple([t[ri] for ri in r]...)
ref(t::Tuple, b::AbstractArray{Bool}) = ref(t,find(b))

## iterating ##

Expand Down

0 comments on commit 66ae77a

Please sign in to comment.