Narcissistic decimal number: Difference between revisions
Content deleted Content added
→Haskell :: Reduced search: Simpler predicate, digitList domain extended to 0 |
m →Haskell :: reduced search: Orthography |
||
Line 2,025: | Line 2,025: | ||
narcissiOfLength :: Int -> [Int] |
narcissiOfLength :: Int -> [Int] |
||
narcissiOfLength nDigits = snd <$> |
narcissiOfLength nDigits = snd <$> go nDigits [] |
||
where |
where |
||
powers = ((,) <*> (^ nDigits)) <$> [0 .. 9] |
powers = ((,) <*> (^ nDigits)) <$> [0 .. 9] |
||
go n parents = |
|||
bool |
bool |
||
(filter (isDaffodil nDigits . snd) parents) |
(filter (isDaffodil nDigits . snd) parents) |
||
( |
(go |
||
(n |
(pred n) |
||
(bool |
(bool |
||
(parents >>= |
(parents >>= |
||
Line 2,061: | Line 2,061: | ||
putStrLn $ |
putStrLn $ |
||
fTable |
fTable |
||
" |
"Narcissistic decimal numbers of length 1-7:\n" |
||
show |
show |
||
show |
show |
||
Line 2,074: | Line 2,074: | ||
s : fmap (((++) . rjust w ' ' . xShow) <*> ((" -> " ++) . fxShow . f)) xs</lang> |
s : fmap (((++) . rjust w ' ' . xShow) <*> ((" -> " ++) . fxShow . f)) xs</lang> |
||
{{Out}} |
{{Out}} |
||
<pre> |
<pre>Narcissistic decimal numbers of length 1-7: |
||
1 -> [0,1,2,3,4,5,6,7,8,9] |
1 -> [0,1,2,3,4,5,6,7,8,9] |