Skip to content

Bikeshed short syntax for Base.IdentityUnitRange(a:b) #32716

Open

Description

Given our fundamental indexing axiom b = a[inds] implies b[j] == a[inds[j]], it's important to pay attention to the indices-of-your-indices. (Latest example: https://discourse.julialang.org/t/linearindices-for-non-1-based-indices/26906.) I'm wondering if we need a short, simple syntax for Base.IdentityUnitRange(a:b). My favorite options are \tricolonTAB and \vdotsTAB, which look like this:

(a, b) = Base.IdentityUnitRange(a:b)

After this you can write 0⁝5. (\tricolon has better horizontal centering than \vdots.) Both of these already have the same operator precedence as :. Other theoretical alternatives are \brokenbar and \tdcol but both currently are not usable as binary operators.

Aside from notation, there's a question about where this should live. Obviously one can define this in a package and hope that it becomes standard. The question here is, is this sufficiently fundamental that it should be in Base? We do not currently have an exported interface to access Base.IdentityUnitRange but it's pretty essential for an awful lot of generic indexing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]designDesign of APIs or of the language itselfunicodeRelated to unicode characters and encodings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions