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.87 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.86 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.85 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.84 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.83 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.82 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.81 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.80 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.79 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.78 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.77 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.76 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.75 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.74 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.73 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.72 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.71 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.70 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.69 tracks/elm/exercises/hamming/Hamming.example.elm
trackler-2.2.1.68 tracks/elm/exercises/hamming/Hamming.example.elm