looking for a D3 stl project
monkyyy
crazymonkyyy at gmail.com
Mon Jan 15 22:08:30 UTC 2024
On Monday, 15 January 2024 at 21:48:38 UTC, Nickolay Bukreyev
wrote:
> On Monday, 15 January 2024 at 21:01:54 UTC, monkyyy wrote:
>> I view data as having a place where it actually exists, and
>> would like filter/chunks/slide to fundamentally leave ".index"
>> alone
>
> I’d argue that having an index is not a must-have requirement
> for a data structure.
>
> 1. Singly and doubly linked lists contain data that actually
> exists.
> 2. (Imperative) concatenation of two doubly linked lists is
> (should be) an `O(1)` operation.
> 3. It invalidates indices of the right-hand side list in the
> process.
>
> Therefore, if a list stores its indices, it cannot implement
> concatenation in `O(1)` time. That is, without invalidating its
> ranges/iterators created prior to concatenation.
Its an optional feature even in my example code.
If you're getting a list of indexes from a linked list you picked
the wrong data structure, and if you "countUntil" a string you
will have a bad time once its unicode.
It would be only correct for hash maps(and other key indexed
data) and array-based data structures to implement a .index
iterator in my view.
More information about the Digitalmars-d
mailing list