Re: [julia-users] Re: dispatch on type of tuple from ...

2016-04-03 Thread 'Greg Plowman' via julia-users
I saw your repost on julia-dev, but replying here. m2 won't work because it expects a series of tuple arguments (which if supplied would slurp up into a tuple of tuples). m3 seems the way to go. I wouldn't necessarily look at it as indirect however. Think of it as one function with 2 methods:

Re: [julia-users] Re: dispatch on type of tuple from ...

2016-03-30 Thread Tamas Papp
Hi Bill, It works for a single argument, but not for multiple ones. I have a self-contained example: --8<---cut here---start->8--- module Foos type Foo{T <: Tuple} end m1{T}(f::Foo{Tuple{T}}, index::T...) = 42 # suggested by Bill Hart m2{T}(f::Foo{T},

[julia-users] Re: dispatch on type of tuple from ...

2016-03-23 Thread 'Bill Hart' via julia-users
The following seems to work, but I'm not sure whether it was what you wanted: import Base.getindex type Foo{T <: Tuple} end getindex{T}(f::Foo{Tuple{T}}, index::T...) = 42 Foo{Tuple{Int}}()[9] Bill. On Wednesday, 23 March 2016 14:38:20 UTC+1, Tamas Papp wrote: > > Hi, > > My