On Thursday, 9 January 2025 at 21:56:59 UTC, monkyyy wrote:
Im aware phoboes takes ....more complexity to implement filter and there should be *some* extra complexity to make a bidirectional filter, but when I ussally look into phoboes 1000 line functions I usually make different tradeoffs. What are the actual considerations here?

I don't really understand, what needs to be considerations? Isn't the interface below sufficient?

```d
auto filter(alias F,R)(R r)
{
  struct Filter
  {
    R r;
    auto back()     => r.back;
    auto front()    => r.front;
    auto popFront() => r = r.findNext!F;
    auto popBack()  => r = r.findPrevious!F;
    auto empty()    => r.empty;
    auto save()     => r.save;
  }
  return Filter(r.find!F);
}
```

SDB@79

Reply via email to