Sha256: 118407838d25c471d6d307777a3853b8e64c09fee6a71bf8926d3bf5044851d0

Contents?: true

Size: 347 Bytes

Versions: 325

Compression:

Stored size: 347 Bytes

Contents

module Hamming exposing (..)

import String exposing (length, toList)


distance : String -> String -> Maybe Int
distance left right =
    if length left /= length right then
        Nothing
    else
        List.map2 (\l r -> l /= r) (toList left) (toList right)
            |> List.filter identity
            |> List.length
            |> Just

Version data entries

325 entries across 325 versions & 1 rubygems

Version Path
trackler-2.2.1.107 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.106 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.105 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.104 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.103 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.102 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.101 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.100 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.99 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.98 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.97 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.96 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.95 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.94 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.93 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.92 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.91 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.90 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.89 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.88 tracks/elm/exercises/hamming/Hamming.example.elm