   """
   @spec count([char], char) :: non_neg_integer
   def count(strand, nucleotide) do
-    strand
-    |> Enum.count(&(MapSet.member?(@nucleotides, &1) && &1 == nucleotide))
+    Enum.count strand, fn x -> valid?(x) && x == nucleotide end
   end
 
   @doc """

defmodule NucleotideCount do
  @nucleotides MapSet.new([?A, ?C, ?G, ?T])

  @doc """
  Counts individual nucleotides in a NucleotideCount strand.

  @spec histogram([char]) :: map
  def histogram(strand) do
    strand
    |> Enum.filter(&valid?(&1))
    |> Enum.group_by(& &1)
    |> Enum.map(fn {k, v} -> {k, length(v)} end)
    |> Enum.into(Map.new @nucleotides, &{&1, 0})
  end
end
