How would you implement a function like this:
function foo(a,b...,c)
println(a,b,c)
end
foo(2,3,3,"last")
=> a = 2 , b = (3,3) , c = "last"
I cannot use something like:
function foo(a,b...)
c = b[end]
println(a,b,c)
end
Because I want to dispatch on c, i.e. I want to have methods:
foo(a,b...,c::Foo)
and
foo(a,b...,c::Bar)
Also I cant have something like this:
foo_wrapper(a,b...) = foo(a,b[1:end-1],b[end])
Because I also want to dispatch on foo in general.
Is this somehow posssible?
foo(a::Yada, c::Blah, b...)
that dispatches foo based on a and c, then write a single methodfoo_wrapper(a,b...) = foo(a, b[end], b[1:end-1])
to reorder arguments for foo. – Immeasurable