Personal tools

McCarthy91

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
 
(polish)
 
Line 5: Line 5:
 
     else n - 10
 
     else n - 10
 
</haskell>
 
</haskell>
 +
 +
or with guards:
 +
 +
<haskell>
 +
mccarthy91 n | n <= 100  = mccarthy91 . mccarthy91 . (+11) $ n
 +
            | otherwise = n - 10
 +
</haskell>
 +
 +
[[Category:Code]]

Latest revision as of 06:37, 16 November 2006

mccarthy91 n = 
    if n <= 100
    then (mccarthy91.mccarthy91.(+11)) n 
    else n - 10

or with guards:

mccarthy91 n | n <= 100  = mccarthy91 . mccarthy91 . (+11) $ n
             | otherwise = n - 10