how to count number of letters with std.algorithm.count / std.algorithm.reduce / std.algorithm.map ?
bioinfornatics
bioinfornatics at fedoraproject.org
Fri Nov 16 07:49:12 PST 2012
hi,
I would like to count number of one ore more letter into a string
or list of string (string[]) without use a for loop but instead
using std.algorithm to compute efficiently.
if you have:
string seq1 = "ACGATCGATCGATCGCGCTAGCTAGCTAG";
string[] seq2 = ["ACGATCGATCGATCGCGCTAGCTAGCTAG",
"ACGATGACGATCGATGCTAGCTAG"];
i try :
reduce!( (seq) => seq.count("G"),
seq.count("C"))(tuple(0LU,0LU),seq1)
and got:
Error: undefined identifier seq, did you mean import std?
in morre count seem to request a range then to do multiple count
into one string it is not easy.
Thanks to show to me how do this
Regards
More information about the Digitalmars-d-learn
mailing list