Skip to content

Instantly share code, notes, and snippets.

@amonshiz
Created February 15, 2015 14:58
Show Gist options
  • Save amonshiz/228b72a8ddb02450822d to your computer and use it in GitHub Desktop.
Save amonshiz/228b72a8ddb02450822d to your computer and use it in GitHub Desktop.
import qualified Bioinformatics.DNANucleotide as D
hammingDistance :: (Eq a) => [a] -> [a] -> Int
hammingDistance l1 l2 = length . filter (not) $ zipWith (==) l1 l2
main = do
string1 <- getLine
string2 <- getLine
let dnaString1 = map D.charToDNANucleotide string1
let dnaString2 = map D.charToDNANucleotide string2
putStrLn . show $ hammingDistance dnaString1 dnaString2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment