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