Jump to content

Munchausen numbers: Difference between revisions

m
→‎{{header|Haskell}}: (pruned out one import)
m (added whitespace to the task's preamble.)
m (→‎{{header|Haskell}}: (pruned out one import))
Line 997:
<pre>[1,3435]</pre>
 
The Haskell libraries provide a lot of flexibility – we could also reworkreduce the sum, map, and unfoldunfoldr (above) down to a single foldfoldr:
 
<lang haskell>import ControlData.MonadChar (joindigitToInt)
import Data.Char (digitToInt)
 
isMunchausen :: Int -> Bool
isMunchausen =
let go = (+) . join(id >>=) (^) . digitToInt
in (==) <*> foldr go 0 . show
 
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.