From 66ae77a3d5f1c6cf607336497598bab9608c9125 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Sun, 30 Dec 2012 13:52:34 -0500 Subject: [PATCH] allow some more cases of tuple indexing --- base/tuple.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/base/tuple.jl b/base/tuple.jl index 5ccb6299a3e90..ddf676c734c2c 100644 --- a/base/tuple.jl +++ b/base/tuple.jl @@ -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 ##