Why Phobos is cool

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Jul 7 22:29:36 UTC 2020


On Mon, Jul 06, 2020 at 08:47:36PM +0000, Jordan Wilson via Digitalmars-d wrote:
[...]
> Just now I wanted to find the max value of a column in a text file, my
> thinking went "Excel? It'll take ages to load...I'll just google awk
> or something...hang on a minute, didn't I read somewhere about D
> oneliners?"
> 
> echo 'import std; void main() { File("emu.sift","r").byLine.map!(a =>
> a.splitter(" ").front.to!double).maxElement.writeln; }' | dmd -run -
[...]

Awesome stuff!!  We should collect a library of these one-liners, maybe
on the wiki or something, that can serve as a useful reference.  It can
also be used to show off D's capabilities too.


T

-- 
"You are a very disagreeable person." "NO."


More information about the Digitalmars-d mailing list