Wordle comparison: Difference between revisions

Content added Content deleted
m (→‎{{header|Haskell}}: Replaced bimap with `first`)
m (→‎{{header|Python}}: Pruned out a redundant zip)
Line 460: Line 460:
charCounts(residue)
charCounts(residue)
)(
)(
zip(guess, matches)
matches
)[1]
)[1]




# green :: String -> (Char, Char) -> (String, Int)
# green :: String -> (Char, Char) -> (String, (Char, Int))
def green(residue, tg):
def green(residue, tg):
'''The existing residue of unmatched characters, tupled
'''The existing residue of unmatched characters, tupled
Line 473: Line 473:
'''
'''
t, g = tg
t, g = tg
return (residue, 2) if t == g else (
return (residue, (g, 2)) if t == g else (
[t] + residue, 0
[t] + residue, (g, 0)
)
)