Just where has this language gone wrong?

monarch_dodra monarchdodra at gmail.com
Sun Jul 22 08:13:20 PDT 2012


On Sunday, 22 July 2012 at 03:06:28 UTC, Jens Mueller wrote:
>
> Where is argmin defined? I couldn't find it.
>
> Jens

Argmin don't exist, but it could, and that's what counts. The
important thing in these slides is proof of concept, rather than
actual code snippets.

However, std.algorithm does have minPos, but it works a little
differently. For starters, it requires a binary pred, as opposed
to an unary weight function. second, it returns a range.

Anyways, this gets you the same result:

auto m = s.minPos!((a, b) => a.length < b.length).front;


More information about the Digitalmars-d mailing list