Sha256: 63c46a355c9bcf3f41e702302ec3f7c8b0cd2240567ff2bf32cd2e2bf7b14766

Contents?: true

Size: 422 Bytes

Versions: 66

Compression:

Stored size: 422 Bytes

Contents

module Anagram exposing (detect)

import String exposing (toList, toLower)


detect : String -> List String -> List String
detect word candidates =
    let
        original =
            toLower word

        ref =
            normalize word
    in
    List.filter (\w -> normalize w == ref && toLower w /= original) candidates


normalize : String -> List Char
normalize word =
    word |> toLower |> toList |> List.sort

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.179 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.178 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.177 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.176 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.175 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.174 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.173 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.172 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.171 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.170 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.169 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.167 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.166 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.165 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.164 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.163 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.162 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.161 tracks/elm/exercises/anagram/Anagram.example.elm
trackler-2.2.1.160 tracks/elm/exercises/anagram/Anagram.example.elm