On Wednesday, 13 December 2023 at 20:28:11 UTC, Nick Treleaven
wrote:
This code works for me. (The last 20+ lines are `aaaab`):
```d
import std;
void main() {
char[] as = replicate(['a'], 5);
as[0] = 'b';
foreach (perm; as.byChar.permutations)
writeln(perm);
}
```
Try it on https://run.dlang.io/. Maybe there's some issue on
your machine?
Also if you use `string as = "abcde";` you can see the
permutations better.
Revisiting this, I see that it works now. I suspect that I had
writeln(as);
Nevertheless, nextPermutation() does what I really want, which is:
(given as[4] = 'b')
aaaab
aaaba
aabaa
abaaa
baaaa