Skip to content

Commit 66ae77a

Browse files
committed
allow some more cases of tuple indexing
1 parent b557388 commit 66ae77a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

base/tuple.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
length(t::Tuple) = tuplelen(t)
44
size(t::Tuple, d) = d==1 ? tuplelen(t) : error("invalid tuple dimension")
55
ref(t::Tuple, i::Int) = tupleref(t, i)
6-
ref(t::Tuple, i::Integer) = tupleref(t, int(i))
7-
ref(t::Tuple, r::Ranges) = tuple([t[ri] for ri in r]...)
6+
ref(t::Tuple, i::Real) = tupleref(t, convert(Int, i))
7+
ref(t::Tuple, r::AbstractArray) = tuple([t[ri] for ri in r]...)
8+
ref(t::Tuple, b::AbstractArray{Bool}) = ref(t,find(b))
89

910
## iterating ##
1011

0 commit comments

Comments
 (0)