Re: Why does inputRangeObject fail to derive correctly for RandomAccessInfinite ranges?

2022-07-16 Thread D Lark via Digitalmars-d-learn
On Saturday, 16 July 2022 at 12:40:09 UTC, Paul Backus wrote: On Saturday, 16 July 2022 at 08:40:10 UTC, D Lark wrote: On Wednesday, 13 July 2022 at 01:40:43 UTC, Paul Backus wrote: On Wednesday, 13 July 2022 at 01:23:35 UTC, D Lark wrote: [...] Yes, it should behave the way you expect. The

Re: Why does inputRangeObject fail to derive correctly for RandomAccessInfinite ranges?

2022-07-16 Thread D Lark via Digitalmars-d-learn
On Saturday, 16 July 2022 at 08:40:10 UTC, D Lark wrote: On Wednesday, 13 July 2022 at 01:40:43 UTC, Paul Backus wrote: On Wednesday, 13 July 2022 at 01:23:35 UTC, D Lark wrote: First, please can someone clarify if the behaviour I expect in the last line is consistent with the intention of the

Re: Why does inputRangeObject fail to derive correctly for RandomAccessInfinite ranges?

2022-07-16 Thread D Lark via Digitalmars-d-learn
On Wednesday, 13 July 2022 at 01:40:43 UTC, Paul Backus wrote: On Wednesday, 13 July 2022 at 01:23:35 UTC, D Lark wrote: First, please can someone clarify if the behaviour I expect in the last line is consistent with the intention of the library? Yes, it should behave the way you expect. The

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

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

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

Why does inputRangeObject fail to derive correctly for RandomAccessInfinite ranges?

2022-07-12 Thread D Lark via Digitalmars-d-learn
This is slightly related to this issue I reported earlier: https://forum.dlang.org/post/wghdwxptjfcjwptny...@forum.dlang.org Here's the snippet that captures what fails for me ```dlang import std.range: ElementType, isRandomAccessRange, inputRangeObject, sequence, MostDerivedInputRange,

Re: Why does is the RandomAccessInfinite interface not a valid RandomAccessRange?

2021-12-19 Thread D Lark via Digitalmars-d-learn
On Sunday, 19 December 2021 at 00:07:46 UTC, Paul Backus wrote: On Saturday, 18 December 2021 at 19:48:00 UTC, D Lark wrote: Can someone please tell me if this is expected behaviour and what the reasoning is behind this choice? Looks like a bug. I've filed a report on the D issue tracker:

Why does is the RandomAccessInfinite interface not a valid RandomAccessRange?

2021-12-18 Thread D Lark via Digitalmars-d-learn
The following assertion fails: ```dlang assert(isRandomAccessRange!(RandomAccessInfinite!int)); ``` Whereas this one passes: ```dlang assert(isRandomAccessRange!(RandomAccessFinite!int)); ``` I have compiled this using dmd v2.098.0. Can someone please tell me if this is expected behaviour and

Re: A pass() identity range?

2021-12-02 Thread D Lark via Digitalmars-d-learn
On Thursday, 2 December 2021 at 14:53:31 UTC, D Lark wrote: On Thursday, 2 December 2021 at 14:47:17 UTC, Paul Backus wrote: This is why it's generally frowned upon to revive old threads: the information they contain is often out of date, and potentially misleading to anyone who reads them

Re: A pass() identity range?

2021-12-02 Thread D Lark via Digitalmars-d-learn
On Thursday, 2 December 2021 at 14:47:17 UTC, Paul Backus wrote: On Thursday, 2 December 2021 at 11:35:53 UTC, D Lark wrote: I am a newcomer to D and I am looking for equivalent functionality in phobos (so far I have not found). The function you are looking for is [`std.range.tee`][1]. It

Re: A pass() identity range?

2021-12-02 Thread D Lark via Digitalmars-d-learn
On Thursday, 2 December 2021 at 14:47:17 UTC, Paul Backus wrote: On Thursday, 2 December 2021 at 11:35:53 UTC, D Lark wrote: I am a newcomer to D and I am looking for equivalent functionality in phobos (so far I have not found). The function you are looking for is [`std.range.tee`][1]. It

Re: A pass() identity range?

2021-12-02 Thread D Lark via Digitalmars-d-learn
On Thursday, 2 December 2021 at 13:22:55 UTC, Steven Schveighoffer wrote: On 12/2/21 6:35 AM, D Lark wrote: On Wednesday, 2 January 2013 at 18:49:06 UTC, H. S. Teoh wrote: Note the date of post you are responding to. When the system says "hey, you are responding to a really old thread, let

Re: A pass() identity range?

2021-12-02 Thread D Lark via Digitalmars-d-learn
On Thursday, 2 December 2021 at 13:22:55 UTC, Steven Schveighoffer wrote: On 12/2/21 6:35 AM, D Lark wrote: On Wednesday, 2 January 2013 at 18:49:06 UTC, H. S. Teoh wrote: Note the date of post you are responding to. When the system says "hey, you are responding to a really old thread, let

Re: A pass() identity range?

2021-12-02 Thread D Lark via Digitalmars-d-learn
On Wednesday, 2 January 2013 at 18:49:06 UTC, H. S. Teoh wrote: On Wed, Jan 02, 2013 at 07:19:31PM +0100, bearophile wrote: H. S. Teoh: [...] >but I thought tee() might be a better name. Python programmers have this "tee": http://docs.python.org/3/library/itertools.html#itertools.tee [...]