Re: Using Sequence Range as a SortedRange.

2022-07-13 Thread D Lark via Digitalmars-d-learn
On Wednesday, 13 July 2022 at 22:35:35 UTC, D Lark wrote: On Wednesday, 13 July 2022 at 18:27:22 UTC, D Lark wrote: I am trying to use a sequence range as a sorted range so that I can apply a search on it. For instance this might be used to implement integer square root as so: [...] For the

Re: Using Sequence Range as a SortedRange.

2022-07-13 Thread D Lark via Digitalmars-d-learn
On Wednesday, 13 July 2022 at 18:27:22 UTC, D Lark wrote: I am trying to use a sequence range as a sorted range so that I can apply a search on it. For instance this might be used to implement integer square root as so: [...] For the first snippet, I did not get to that point, but it appear

Using Sequence Range as a SortedRange.

2022-07-13 Thread D Lark via Digitalmars-d-learn
I am trying to use a sequence range as a sorted range so that I can apply a search on it. For instance this might be used to implement integer square root as so: ```dlang auto square(N)(N n) { return n * n; } auto isqrt(int n) { import std.range: sequence, assumeSorted; auto seq =