On Wed, Jan 27, 2010 at 01:24:48PM +0000, Matthew Walton wrote: : On Wed, Jan 27, 2010 at 1:19 PM, Carl Mäsak <cma...@gmail.com> wrote: : > Mark (>), Carl (>>): : >>> S05 describes tr/// in terms of the .trans function, a handsome but : >>> very different beast. Specifically, it doesn't seem to have a "scalar : >>> context", with which one could count things. : >> : >> What does trans return in numeric (+) context? : > : > As spec'd, it returns the numification of the string resulting from : > the substitution, I guess. : > : > // Carl : > : : $str.comb(/C|G/).join('').chars might do it. It's maybe not quite as elegant...
Hmm, what might be more elegant? Maybe something like... [+] $str.comb.Bag<C G>; Probably does too much work building the Bag though, unless it can be lazy somehow. But the point is that Bags are really just histograms with a cute name. Larry