Created
August 16, 2015 15:59
-
-
Save Muzietto/595bef1815ddf375129d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mycont_01 where | |
import Control.Monad.Cont | |
fattoriale :: Int -> Int | |
Cont (\c -> c (fattoriale 0)) = return 1 | |
Cont (\c -> c (fattoriale n)) = Cont (\c -> c (fattoriale (n - 1))) | |
>>= (\x -> Cont (\c -> c (n*x))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment