Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with EllipsisNotation #18

Open
mschauer opened this issue Jul 6, 2017 · 3 comments · Fixed by #57
Open

Compatibility with EllipsisNotation #18

mschauer opened this issue Jul 6, 2017 · 3 comments · Fixed by #57

Comments

@mschauer
Copy link
Member

mschauer commented Jul 6, 2017

I was wondering if .. can be shared between EllipsisNotation and Intervalsets via call overload:

type DotDot
end

const .. = DotDot
..(x,y) = dotdot(x,y)
@timholy
Copy link
Member

timholy commented Jul 6, 2017

Yep, that seems likely to work. Note you can also dispatch on function types:

julia> typeof(..)
IntervalSets.#..

julia> Base.getindex(A::AbstractArray, ::typeof(..)) = println("ellipsis")

julia> A = rand(3,3)
3×3 Array{Float64,2}:
 0.102141  0.733993  0.765183
 0.911817  0.185652  0.898025
 0.506637  0.125062  0.478347

julia> A[..]
ellipsis

Not sure if that's better, though.

If you put together a PR I would merge it.

@hyrodium
Copy link
Collaborator

The dependency on EllipsisNotation was removed, so I will reopen this issue.
#83

@hyrodium hyrodium reopened this Sep 10, 2022
@hyrodium
Copy link
Collaborator

I think it would be nice to have a lightweight package DotDots.jl which defines DotDot struct.

struct DotDot <: Function end
const (..) = DotDot()

And both IntervalSets.jl and EllipsisNotation.jl should depend on DotDots.jl package, but this approach is a kind of type piracy..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants