Sha256: 05f55e629e731d083ba88d28cf138b2ed4455486b55fb109d209a02e7f0fe08c

Contents?: true

Size: 326 Bytes

Versions: 394

Compression:

Stored size: 326 Bytes

Contents

module Anagram (anagramsFor) where
import Data.List (sort)
import Data.Char (toLower)

anagramsFor :: String -> [String] -> [String]
anagramsFor word = filter (isAnagram . normalize)
  where
    normalize xs = let nxs = map toLower xs in (nxs, sort nxs)
    (nw, sw) = normalize word
    isAnagram (w, s) = nw /= w && sw == s

Version data entries

394 entries across 394 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.179 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.178 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.177 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.176 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.175 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.174 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.173 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.172 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.171 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.170 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.169 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.167 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.166 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.165 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.164 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.163 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.162 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.161 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.160 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs