Miscellany
public text v1 · immutableproblem4 = head $ sortBy greatestFirst $ filter isPalindrome $ zipWith (*) [999,998..100] [999,998..100]
greatestFirst :: Ord a => a -> a -> Ordering
greatestFirst x y = switch $ compare x y
where
switch EQ = EQ
switch LT = GT
switch GT = LT
isPalindrome :: Integer -> Bool
isPalindrome x = digits x == reverse (digits x)
digits :: Integral a => a -> [a]
digits x
| x < 10 = [x]
| otherwise = x `mod` 10 : (digits (x `div` 10))