Wordle comparison: Difference between revisions

m
→‎{{header|Haskell}}: Replaced bimap with `first`
(→‎{{header|Python}}: Updated output to include raw integer scores)
m (→‎{{header|Haskell}}: Replaced bimap with `first`)
Line 147:
 
=={{header|Haskell}}==
<lang haskell>import Data.Bifunctor (bimapfirst)
import Data.List (intercalate, mapAccumL)
import qualified Data.Map.Strict as M
Line 160:
snd $
uncurry (mapAccumL amber) $
bimapfirst charCounts (zip guess) $
mapAccumL green [] (zip target guess)
 
green :: String -> (Char, Char) -> (String, (Char, Int))
green residue (t, g)
| t == g = (residue, (g, 2))
| otherwise = (t : residue, (g, 0))
 
amber :: Tally -> (Char, Int) -> (Tally, Int)
9,655

edits