EDIT: mis-formatted previous snippet

import std.algorithm, std.stdio, std.range, std.conv;
void main()
{
    stdin
        .byLine
.filter!(s => !s.empty && s.front != '#’) // Filter with this lambda function
        .map!(s => s.to!double) // Map the strings to doubles
        .array // Sorting needs random access
        .sort!((a, b) => a < b) // Another lambda
        .take(10) // Applyable to any range
        .writeln;
}

Reply via email to