Munchausen numbers: Difference between revisions
m
→AppleScript :: Functional
(→{{header|AppleScript}}: Added subheadings after restoring inadvertent deletion of another variant.) |
|||
Line 252:
=={{header|AppleScript}}==
===Functional===
<lang AppleScript>
-- isMunchausen :: Int -> Bool
Line 266:
(class of n is integer) and ¬
n = foldl(digitPowerSum, 0, characters of (n as string))
end isMunchausen
on run
Line 281:
-- enumFromTo :: Int -> Int -> [Int]
on enumFromTo(m, n)
if m
set
set end of lst to i▼
end repeat▼
else
end if
▲ repeat with i from m to n by d
▲ set end of lst to i
▲ end repeat
▲ return lst
end enumFromTo
-- filter :: (a -> Bool) -> [a] -> [a]
on filter(
tell mReturn(
set lst to {}
set lng to length of xs
|