Am Do., 3. Sept. 2020 um 09:11 Uhr schrieb Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>: [...] > A thought: What do you think about keeping the indexer-composing > version in the two-range case of range-append? e.g. > > (define range-append > (case-lambda > ; ... > ((ra rb) ; two-range fast path > (let ((la (range-length ra)) > (lb (range-length rb))) > (raw-range 0 > (+ la lb) > (lambda (i) > (if (< i la) > (range-ref ra i) > (range-ref rb (- i la))))))) > ; ... > )) > > This indexer is O(1) on its own, and successive two-range appends > would, in essence, build a binary search tree associating indices with > ranges. > > The variadic case would still return a vector-style range. That idea is not sufficient if you add successively add one-element ranges with range-append. Please see my other post for a general solution.