From 7f5c2eaead3ab57e358eda20e1cc50f74765c256 Mon Sep 17 00:00:00 2001 From: Wesley Kerfoot <378351+weskerfoot@users.noreply.github.com> Date: Mon, 27 Jan 2020 14:25:25 -0500 Subject: [PATCH] cleanup --- sorted_digits.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sorted_digits.hs b/sorted_digits.hs index 7b6b3df..456ad52 100644 --- a/sorted_digits.hs +++ b/sorted_digits.hs @@ -3,10 +3,10 @@ import Data.List digits :: Int -> [Int] digits n = unfoldr nextDigit n where nextDigit 0 = Nothing - nextDigit c = Just $ (c `mod` 10, c `div` 10) + nextDigit c = Just (c `mod` 10, c `div` 10) isSorted :: Int -> Bool -isSorted n = (all (uncurry (<=)) ds') || (all (uncurry (>=)) ds'') +isSorted n = all (uncurry (<=)) ds' || all (uncurry (>=)) ds'' where ds = digits n ds' = zip ds (maxBound : ds) ds'' = zip ds (minBound : ds)