Steve Sobel:

It can get down to 155 using ranges, but those imports really are killer.

You usually don't want to design a language for code golfing (but several exist, like http://esolangs.org/wiki/GolfScript ).


void main(){import std.algorithm,std.conv,std.range,std.stdio;foreach(n;stdin.byLine.drop(1))writefln("%.15f",iota(n.to!int).map!"(-1.0)^^a/(2*a+1)".sum);}

You can remove one char:

iota(n.to!int).

n.to!int.iota.

Bye,
bearophile

Reply via email to