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.139 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.138 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.137 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.136 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.135 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.134 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.133 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.132 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.131 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.130 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.129 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.128 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.127 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.126 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.125 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.124 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.123 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.122 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.121 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.120 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs