Last active
March 18, 2018 22:19
-
-
Save johnwesonga/2f4a4b8ad8e007266f8e6f93ca0fdf30 to your computer and use it in GitHub Desktop.
Factorial in PureScript
This file contains hidden or 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 Main where | |
import Prelude (show, ($), (=<<), (+), (<>), (*), (-)) | |
import Control.Monad.Eff.Console(log) | |
import TryPureScript | |
fact :: Int -> Int | |
fact 0 = 1 | |
fact n = n * fact(n-1) | |
main = render =<< withConsole do | |
log $ show $ fact 6 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment