Hi Fredrick, On Fri, Aug 8, 2014 at 4:04 PM, Frederick <[email protected]> wrote:
> In the documentation: > count(*p*, *itr*) → Integer > > Count the number of elements in itr for which predicate p is true. > >> x = count(c->(c=="A"), "ACTGA") >> print(x) >> > gives the string "ACTGA", when expected 2 > > Am I missing something, or is the documentation incorrect? > This should work find, though not quite how you're using it: julia> count(c->(c=="A"), "ACTGA") 0 julia> count(c->(c=='A'), "ACTGA") 2 julia> "A" == 'A' false julia> "A"[1] == 'A' true In Julia, 'A' indicates the character A, and "A" indicates the length-1 string "A", and these are not equivalent. Did you really get an answer of "ACTGA", or was that a typo? If it wasn't a typo, I'm guessing that you accidentally redefined "count", and that if you restart julia, everything would work fine. Cheers, Kevin
