On Thursday, 17 August 2023 at 09:28:05 UTC, Joel wrote:
            .map!(std.uni.toLower)
            .sort!"a<b"
            .writeln;
    }
    ```
onlineapp.d(8): Error: none of the overloads of template `std.algorithm.sorting.sort` are callable using argument types `!("a<b")(MapResult!(toLower, ByCodeUnitImpl))` /dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/sorting.d(1925): Candidate is: `sort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable, Range)(Range r)`
      with `less = "a<b",
           ss = SwapStrategy.unstable,
           Range = MapResult!(toLower, ByCodeUnitImpl)`
      must satisfy one of the following constraints:
    `       hasSwappableElements!Range
           hasAssignableElements!Range
           ss != SwapStrategy.unstable`

`map` generates a range `r` whose elements can be accessed by mutable reference only if the result of calling the map function (on a source element) is a mutable reference. But `std.uni.toLower` returns by value, and `sort` requires `r.front` to be a mutable reference.

I'll look at improving the docs.

Reply via email to