On Tuesday, 27 January 2026 at 16:38:08 UTC, Lars Johansson wrote:
This is a prestudy for map&reduce.
strings are the foot gun, use ints and write your own,
*unannotated* and simple to understand.
using the std algorithms means they will be aviable, but it comes
with bad naming, the "auto decoding" problems and complexity.
```d
import std;
auto counter(int i){
struct count{
int front;
int end;
void popFront(){front++;}
bool empty()=>front>=end;
}
return count(0,i);
}
unittest{
foreach(i;counter(10)){
i.writeln;
}}
//todo make `counter(5).take(3).map!(a=>a*2)` return [0,2,4]
```