Sha256: 2e24741ad808d56421011f186338193e4f142e550f5b08b20c3c2a32637d918b

Contents?: true

Size: 442 Bytes

Versions: 135

Compression:

Stored size: 442 Bytes

Contents

exception NonEqualLengthStringsFound

fun distance (strand1: string, strand2: string): int =
  let
    val chars1 = explode strand1
    val chars2 = explode strand2
    fun distance' ([], []) acc = acc
      | distance' ((x::xs), (y::ys)) acc =
          distance' (xs, ys) (acc + (if x = y then 0 else 1))
  in
    if (length chars1) <> (length chars2) then
      raise NonEqualLengthStringsFound
    else distance' (chars1, chars2) 0
  end

Version data entries

135 entries across 135 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.179 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.178 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.177 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.176 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.175 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.174 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.173 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.172 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.171 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.170 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.169 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.167 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.166 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.165 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.164 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.163 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.162 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.161 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.160 tracks/sml/exercises/hamming/example.sml