--
And I'd like map/filter to accept arrays and associative
arrays, and not just functions:
void main() {
import std.algorithm: map;
auto keys = [1, 2, 1, 1, 1];
auto a = [0, 10, 20];
auto r1 = map!(k => a[k])(keys); // OK
auto r2 = map!a(keys); // Error
a
Jakob Ovrum and others have added an enumerate() function to
Phobos:
https://issues.dlang.org/show_bug.cgi?id=5550
https://github.com/D-Programming-Language/phobos/pull/1866
A problem with enumerate() (present in other ranges too):
void main() {
import std.stdio, std.range;
auto A = [0, 0