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

Version Path
trackler-2.2.1.3 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.2 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.1 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.0 tracks/sml/exercises/hamming/example.sml
trackler-2.2.0.6 tracks/sml/exercises/hamming/example.sml
trackler-2.2.0.5 tracks/sml/exercises/hamming/example.sml
trackler-2.2.0.4 tracks/sml/exercises/hamming/example.sml
trackler-2.2.0.3 tracks/sml/exercises/hamming/example.sml
trackler-2.2.0.2 tracks/sml/exercises/hamming/example.sml
trackler-2.2.0.1 tracks/sml/exercises/hamming/example.sml
trackler-2.2.0.0 tracks/sml/exercises/hamming/example.sml
trackler-2.1.0.55 tracks/sml/exercises/hamming/example.sml
trackler-2.1.0.54 tracks/sml/exercises/hamming/example.sml
trackler-2.1.0.53 tracks/sml/exercises/hamming/example.sml
trackler-2.1.0.52 tracks/sml/exercises/hamming/example.sml
trackler-2.1.0.51 tracks/sml/exercises/hamming/example.sml
trackler-2.1.0.50 tracks/sml/exercises/hamming/example.sml
trackler-2.1.0.49 tracks/sml/exercises/hamming/example.sml
trackler-2.1.0.48 tracks/sml/exercises/hamming/example.sml
trackler-2.1.0.47 tracks/sml/exercises/hamming/example.sml