On Thursday, 8 June 2017 at 01:57:47 UTC, Andrew Edwards wrote:
Ranges may be finite or infinite but, while the destination may be unreachable, we can definitely tell how far we've traveled. So why doesn't this work?

import std.traits;
import std.range;

void main()
{
    string[string] aa;

    // what others have referred to as
    // standard sort works but is deprecated
    //auto keys = aa.keys.sort;

// Error: cannot infer argument types, expected 1 argument, not 2
    import std.algorithm: sort;
    auto keys = aa.keys.sort();

    // this works but why should I have to?
    //import std.array: array;
    //auto keys = aa.keys.sort().array;

    foreach (i, v; keys){}
}

If I hand you a chihuahua for grooming, why am I getting back a pit bull? I simply want a groomed chihuahua. Why do I need to consult a wizard to get back a groomed chihuahua?

You may want to slice chihuahua first, pass it to mir.ndslice.sort [1], and get back your groomed sliced chihuahua.

[1] http://docs.algorithm.dlang.io/latest/mir_ndslice_sorting.html#.sort.sort

Reply via email to