On Wednesday, 10 June 2020 at 15:34:57 UTC, Steven Schveighoffer wrote:
My biggest problem with enumerate is that you can't bind the tuple to parameters for something like map:

arr.enumerate.map!((idx, val) => ...)

doesn't work. Instead you have to do:

arr.enumerate.map!((tup) => ...)

And use tup[0] and tup[1].

-Steve

```
alias tupArg(alias func) = x => func(x.expand);
arr.enumerate.map!(tupArg!((idx, val) => ...))
```

Somewhat heavy on syntax, but better than `tup[0]` or `tup[1]` IMO.

Reply via email to