pullAt

Returns a range excluding the specified indices.

The indices can be given as a range of indices, or single integral arguments or a mixture of both. All index arguments will be $(DDOX_NAMED_REF algorithm.concat, `concat`)ed together and sorted before returning a range that then goes through the original range exlusing the resulting concatenation of indices.

The running time is O(n) if indices is a single sorted range or a single index to remove, else there's an additional cost of standard sort running time.

pullAt
(
Range
Indices...
)
(
Range range
,
Indices indices
)
if (
from!"std.range".isInputRange!Range &&
from!"std.meta".allSatisfy!(from!"std.traits".isIntegral, from!"bolts.meta".Flatten!Indices)
)

Parameters

range
Type: Range

an input range

indices
Type: Indices

zero or more integral elements or ranges

Return Value

Type: auto

A range excluding the supplied indices

Benchmarks:

  • single args: pullAt(8, 16, 14...)
  • single range: pullAt([8, 16, 14...])
  • sorted range: pullAt([8, 16, 14...].sort)
  • canFind range: indices.filter!(canFind)
  • canFind sorted: indices.sort.filter!(canFind)
  • 1 Benchmarking pullAt against filter/canFind:
    2   numbers: [12, 11, 1, 9, 11, 4, 1, 4, 2, 7, 16, 8, 8, 9, 6, 15, 9, 0, 15, 2]
    3   indices: [8, 16, 14, 11, 0, 16, 12, 10, 15, 17]
    4 pullAt:
    5   single args:    3 ms, 885 μs, and 6 hnsecs
    6   single range:   1 ms and 610 μs
    7   sorted range:   185 μs and 2 hnsecs
    8   canFind range:  5 ms and 547 μs
    9   canFind sorted: 4 hnsecs
    10 pullAt (with .array):
    11   single args:    8 ms, 765 μs, and 8 hnsecs
    12   single range:   6 ms, 823 μs, and 8 hnsecs
    13   sorted range:   6 ms, 571 μs, and 2 hnsecs
    14   canFind range:  10 ms, 479 μs, and 2 hnsecs
    15   canFind sorted: 9 ms, 330 μs, and 5 hnsecs

    Meta

    Since

    0.0.1