• Re: array from static predicate on enumerated type

    From Thomas@21:1/5 to Dmitry A. Kazakov on Wed Mar 16 01:38:41 2022
    In article <s2ofr1$1cg3$1@gioia.aioe.org>,
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

    On 2021-03-15 18:48, Shark8 wrote:

    So, in Ada, there's no good choice for how to actually DO an array with gaps in the index:

    That applies to all containers. The problem is mapping the key to a
    dense position when the key is not dense or might be unordered.

    There is no gaps in positions.

    But Array *isn't* a map, though often it is substituted as one.

    Of course it is, per definition of mapping. f : key -> element.

    Array has further constraints, like the contiguous memory labeled above.

    No. The constraint here is a dense index. That is not specific to a
    general map or an array. It is a fundamental property of the set of keys being a convex set. Convex ensures certain useful mathematical
    properties invariant to the representation of the mapping. In
    particular, it gives a way to enumerate elements.

    Arbitrary predicate kills convex, so the problem. Not array. A map would
    have just same problem: a map of LETTERS is in general not substitutable
    for a map of CURVED_LETTERS.

    i don't understand,
    since Ada.Containers.Ordered_Maps.Key_Type is private,
    and so new Ada.Containers.Ordered_Maps (CURVED_LETTERS, Integer) is

    RAPID maintainer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)