Narcissistic decimal number: Difference between revisions

→‎Haskell reduced search: (used swap in digitList)
(→‎Haskell - Reduced search: (used unfoldr for digitList))
(→‎Haskell reduced search: (used swap in digitList))
Line 1,314:
 
<lang haskell>import Data.List (sort, unfoldr)
import Data.Tuple (swap)
 
narcissiOfLength :: Int -> [Int]
Line 1,328 ⟶ 1,329:
(\x ->
if x > 0
then letJust (q, r) =swap (quotRem x 10))
in Just (r, q)
else Nothing)
 
9,655

edits