Carmack about static analysis

Timon Gehr timon.gehr at gmx.ch
Sun Dec 25 15:41:13 PST 2011


On 12/26/2011 12:30 AM, bearophile wrote:
> Timon Gehr:
>
>>> http://pastebin.com/C6vf9DQQ
>
> If possible I suggest to remove all the BigInt from the module, and put the bigint import into the main():
>
> void main() {
>      import std.bigint;
>      auto h = hamming!BigInt();
>      writeln(take(20, h));
>      writeln(h()[1_691]);
>      writeln(h()[1_000_000]);
> }
>

That could be done, but I don't think it is terribly important.

>
>> @nonstrict:
>>
>> r=cast(T)1
>>       .cons(
>>                    r.map((a)=>  2*a)
>>             .merge(r.map((a)=>  3*a))
>>             .merge(r.map((a)=>  5*a))
>>       );
>
> This version looks acceptable :-)
>
> Bye,
> bearophile

It would be even better with methods-as-operators:

r=cast(T)1 cons (( r map a=>2*a ) merge ( r map a=>3*a ) merge ( r map 
a=>5*a ))














More information about the Digitalmars-d mailing list