Munchausen numbers: Difference between revisions
Content added Content deleted
m (→{{header|Nim}}) |
(→{{header|Haskell}}: Further reduced the digitToInt version) |
||
Line 794:
The Haskell libraries provide a lot of flexibility – we could also rework the sum, map, and unfold above to a single fold:
<lang haskell>import
import Data.Char (digitToInt)
isMunchausen :: Int -> Bool
isMunchausen
in (==) <*> foldr go 0 . show
▲ let v = digitToInt c
main :: IO ()
main = print $ filter isMunchausen [1 .. 5000]</lang>
{{Out}}
<pre>[1,3435]</pre>
|