How to sort byCodeUnit.permutations.filter(...)
Uknown
sireeshkodali1 at gmail.com
Mon Jun 11 04:39:54 UTC 2018
On Monday, 11 June 2018 at 04:12:57 UTC, Adam D. Ruppe wrote:
> On Monday, 11 June 2018 at 04:06:44 UTC, Uknown wrote:
>> The problem is this prints a list of numbers. The task
>> requires only the largest, so the intuitive fix
>
> I would just pull the max out of it.
>
> http://dpldocs.info/experimental-docs/std.algorithm.searching.maxElement.2.html
Thanks for your reply. I completely forgot about maxElement. I
used it, but it prints 1234567, not the permutations. The same
happens when using array. Why are the strings getting modified?
The same happens with this:
"123".byCodeUnit.permutations.writeln;//[123, 213, 312, 132, 231,
321]
"123".byCodeUnit.permutations.array.writeln;//[123, 123, 123,
123, 123, 123]
Seems odd. Is this a bug or expected behaviour?
More information about the Digitalmars-d-learn
mailing list