On Wednesday, 7 July 2021 at 01:44:20 UTC, Steven Schveighoffer
wrote:
But it got me thinking, how often do people roll their own vs.
trying to compose using existing Phobos nuggets?
When there's not an obvious/simple way to do something by
composing ranges, I tend to just give up and write
On 7/7/21 3:52 PM, Sebastiaan Koppe wrote:
On Wednesday, 7 July 2021 at 13:30:28 UTC, Steven Schveighoffer wrote:
On 7/7/21 5:54 AM, rassoc wrote:
On Wednesday, 7 July 2021 at 01:44:20 UTC, Steven Schveighoffer wrote:
So I have this situation where I need to split a string, then where
the
On Wednesday, 7 July 2021 at 19:52:30 UTC, Sebastiaan Koppe wrote:
Just lift each item in a range then:
```d
import std;
auto foo(string s, string sp, string j) @nogc {
return s.splitter(sp).map!(i => only(i)).joiner(only(j));
}
```
Code golf: `map!(i => only(i))` can be shortened to
On Wednesday, 7 July 2021 at 13:30:28 UTC, Steven Schveighoffer
wrote:
On 7/7/21 5:54 AM, rassoc wrote:
On Wednesday, 7 July 2021 at 01:44:20 UTC, Steven
Schveighoffer wrote:
So I have this situation where I need to split a string, then
where the splits are, insert a string to go between the
On 7/7/21 5:54 AM, rassoc wrote:
On Wednesday, 7 July 2021 at 01:44:20 UTC, Steven Schveighoffer wrote:
So I have this situation where I need to split a string, then where
the splits are, insert a string to go between the elements making a
new range, all without allocating (hopefully).
On 7/6/21 11:42 PM, Jon Degenhardt wrote:
On Wednesday, 7 July 2021 at 01:44:20 UTC, Steven Schveighoffer wrote:
This is pretty minimal, but does what I want it to do. Is it ready for
inclusion in Phobos? Not by a longshot! A truly generic interleave
would properly forward everything else that
On Wednesday, 7 July 2021 at 01:44:20 UTC, Steven Schveighoffer
wrote:
So I have this situation where I need to split a string, then
where the splits are, insert a string to go between the
elements making a new range, all without allocating (hopefully).
Without considering the more general
On Wednesday, 7 July 2021 at 01:44:20 UTC, Steven Schveighoffer
wrote:
This is pretty minimal, but does what I want it to do. Is it
ready for inclusion in Phobos? Not by a longshot! A truly
generic interleave would properly forward everything else that
the range supports (like `length`,
So I have this situation where I need to split a string, then where the
splits are, insert a string to go between the elements making a new
range, all without allocating (hopefully).
Looking around phobos I found inside the documentation of