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.78 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.77 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.76 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.75 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.74 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.73 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.72 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.71 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.70 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.69 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.68 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.67 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.66 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.65 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.64 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.63 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.62 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.61 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.60 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.59 tracks/sml/exercises/hamming/example.sml