Sha256: e666f7326d6ae66449aeef6425c1fff9432fbfbd7520f8c7e83e54e535546687
Contents?: true
Size: 372 Bytes
Versions: 261
Compression:
Stored size: 372 Bytes
Contents
exception NonEqualLengthStringsFound; fun hamming (s1, s2) = let val chars1 = explode s1 val chars2 = explode s2 fun hamming' ([],[]) acc = acc | hamming' ((x::xs),(y::ys)) acc = hamming' (xs, ys) (acc + (if x = y then 0 else 1)) in if (length chars1) <> (length chars2) then raise NonEqualLengthStringsFound else hamming' (chars1, chars2) 0 end
Version data entries
261 entries across 261 versions & 1 rubygems