Narcissistic decimal number: Difference between revisions

m
Line 1,095:
 
digitGroups :: Int -> [[Int]]
digitGroups nDigits = risingDigitssortedDigits nDigits []
where
digits = [0 .. 9]
risingDigitssortedDigits 0 ns = ns
risingDigitssortedDigits n [] = risingDigitssortedDigits (n - 1) $ (: []) <$> digits
risingDigitssortedDigits n ns = risingDigitssortedDigits (n - 1) $ foldMap prependHeadMinus ns
prependHeadMinus xxs@(x:xs) = (: xxs) <$> [0 .. x]
 
9,659

edits