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.27 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.26 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.25 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.24 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.23 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.22 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.21 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.20 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.19 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.18 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.17 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.16 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.15 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.14 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.13 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.12 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.11 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.10 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.9 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.8 tracks/elm/exercises/hamming/Hamming.example.elm