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 was added to Phobos in 2014 by [pull request #1965][2], approximately one year after the post you replied to.

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 without looking carefully at the timestamps.

[1]: https://phobos.dpldocs.info/std.range.tee.1.html
[2]: https://github.com/dlang/phobos/pull/1965
I had see the std.range.tee, but it does not appear to me to be the same as itertools.tee. I think with std.range.tee you get an input range and an output range out of an input range. With python's itertool.tee you get two or more input ranges from an input range (hence my claim earlier that it sort of simulates forwardRange.save).

I felt the need to reply in-line to correct the misconception from that post that itertools.tee "basically works on forwardRanges". It does something very different, there is no "forwardRange" in python the only range concept (iterators) are equivalent to inputRanges and nothing more.

Reply via email to