[Gambas-user] Sparse arrays? Possible?

Jussi Lahtinen jussi.lahtinen at gmail.com
Sun Mar 8 19:36:04 CET 2020


Can you open bit more why using collection is out of the question?

Jussi

On Sun, Mar 8, 2020 at 7:16 AM Bruce <adamnt42 at gmail.com> wrote:

> Firstly, I haven't tried this but I was wondering if it is possible.
>
> Given a set of objects that have an ordinal characteristic (not a
> property of the object itself and not encountered in the ascending order
> of that characteristic) is it possible to construct an array of such
> objects that is only sparsely populated?
>
> Let's say we have the following objects, with that derived
> characteristic in brackets: Ahab(3),Chab(6), Fhab(2) and Ghab(7).
> I want to fill the array such that its' final representation is
> [0] -
> [1] -
> [2] Fhab
> [3] Ahab
> [4] -
> [5] -
> [6] Chab
> [7] Ghab
>
> I don't know at the outset what the maximum ordinal value is and so I
> don't know the size of the array.
> There are reasons for using an array rather than a collection keyed by
> the value.
> The source of the objects is unsortable, they arrive over time in a
> random order.
>
> Any thoughts?
> b
>
> p.s. It's like the IP layer in TCP/IP putting the packets back in order
> to rebuild the entire message.
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200308/64ca63ea/attachment.html>


More information about the User mailing list