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.98 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.97 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.96 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.95 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.94 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.93 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.92 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.91 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.90 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.89 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.88 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.87 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.86 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.85 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.84 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.83 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.82 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.81 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.80 tracks/sml/exercises/hamming/example.sml
trackler-2.2.1.79 tracks/sml/exercises/hamming/example.sml