Open LilithHafner opened 11 months ago
That's a very good list! I have the "you get these methods" part of interfaces implemented on a branch, but it's not yet merged into main. Still needs some tests!
I've also thought about whether (and how) this package should have these kinds of existing interfaces as part of a checkable set of default interfaces. It's sometimes a bit unclear, because having a fallback definition actually throwing an NotImplementedError
would be piracy and cause lots of invalidations.. Still, collecting these implicit interfaces is a good idea.
A similar list can probably be done for the rand
family of functions.
The "you get these methods" list will always be incomplete, but I still think it's good to have.
A similar list can probably be done for the
rand
family of functions.
Yes, that would be nice to have.
Of course - the "you get these methods" list is purely intended as a "we guarantee to support at least these calls", not as an exhaustive list of what technically works. Otherwise it could be automated via reflection.
The most prominent interfaces defined in base are listed in the documentation. Here are some others:
Rounding
Define
MyType <: Real
Base.round(::MyType, ::RoundingMode)
Get
round(::Type{T}, ::MyType, ::RoundingMode)
round(::Type{T}, ::MyType)
floor(::Type{T}, ::MyType)
ceil(::Type{T}, ::MyType)
trunc(::Type{T}, ::MyType)
round(::MyType)
floor(::MyType)
ceil(::MyType)
trunc(::MyType)
Sorting
Define
Base.isless(::MyType, ::MyType)
Get
issorted(::AbstractVector{MyType})
sort(::AbstractVector{MyType}; kw...)
sort!(::AbstractVector{MyType}; kw...)
sortperm(::AbstractVector{MyType}; kw...)
sortperm!(::AbstractVector{<:Integer}, ::AbstractVector{MyType}; kw...)
partialsort(::AbstractVector{MyType}; kw...)
partialsort!(::AbstractVector{MyType}; kw...)
partialsortperm(::AbstractVector{MyType}; kw...)
partialsortperm!(::AbstractVector{<:Integer}, ::AbstractVector{MyType}; kw...)