The Anh Tran:
> This is just a small D exercise. I port c++ knucleotide from 
> shootout.alioth.debian.org

This was my version, maybe it solves some of your problems:
http://shootout.alioth.debian.org/debian/benchmark.php?test=knucleotide&lang=gdc&id=2

I haven't used my dlibs here, so for example that sort in the middle is long 
and ugly (and not fully correct, that opCmp doesn't compare accordingly both 
key and value, as the problem specs state: "sorted by descending frequency and 
then ascending k-nucleotide key"), in Python it becomes:
l = sorted(frequences.items(), reverse=True, key=lambda (seq,freq): (freq,seq))
With my dlibs it's similar. You can probably do something similar with Phobos2.

By the way, the formatting of your code needs improvements, reduce indentation 
length and format code in a more readable way.

Bye,
bearophile

Reply via email to