learning F#, it seems pretty cool, favourite functional language so far.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678
  1. module Hamming
  2. let hamming s1 s2 =
  3. let pairs = Seq.zip s1 s2
  4. Seq.fold (fun a x -> if (x |> fst) <> (x |> snd) then (a + 1) else a) 0 pairs
  5. let distance (strand1: string) (strand2: string): int option =
  6. if String.length strand1 <> String.length strand2 then None else Some(hamming strand1 strand2)