projects
/
advent-of-code-23.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Alternative use of both view
[advent-of-code-23.git]
/
advent07
/
Main.hs
diff --git
a/advent07/Main.hs
b/advent07/Main.hs
index b839511444c0d4eb4f8102b5b3a20596a2e6eb17..8f4350d293e9fd37abba85ad702396b214a923dd 100644
(file)
--- a/
advent07/Main.hs
+++ b/
advent07/Main.hs
@@
-40,10
+40,7
@@
enJoker (Hand cards bid) = Hand jCards bid
where jCards = replace Jack Joker cards
replace :: Eq a => a -> a -> [a] -> [a]
where jCards = replace Jack Joker cards
replace :: Eq a => a -> a -> [a] -> [a]
-replace _ _ [] = []
-replace f t (x:xs)
- | x == f = t : replace f t xs
- | otherwise = x : replace f t xs
+replace f t = fmap (\x -> if x == f then t else x)
classify :: Hand -> ClassifiedHand
classify (Hand cards bid)
classify :: Hand -> ClassifiedHand
classify (Hand cards bid)