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.159 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.158 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.157 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.156 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.155 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.154 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.153 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.152 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.151 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.150 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.149 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.148 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.147 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.146 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.145 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.144 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.143 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.142 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.141 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs
trackler-2.2.1.140 tracks/haskell/exercises/anagram/examples/success-liststring/src/Anagram.hs