day 3: elemIndex exists, amaze
This commit is contained in:
parent
6ef036e2c5
commit
e544fbb877
|
@ -31,5 +31,5 @@ intersections :: [V2 Int] -> [V2 Int] -> Set.Set (V2 Int)
|
|||
intersections xs ys = Set.delete (V2 0 0) crossset
|
||||
where crossset = (Set.fromList xs) `Set.intersection` (Set.fromList ys)
|
||||
|
||||
day3b xs ys = minimum [let f = fromJust . findIndex (==x) in
|
||||
day3b xs ys = minimum [let f = fromJust . elemIndex x in
|
||||
f xs + f ys | x<-Set.toList $ intersections xs ys]
|
||||
|
|
Loading…
Reference in New Issue
Block a user