Skip to content

Instantly share code, notes, and snippets.

@amnn
Created April 28, 2016 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amnn/1459f884ae70ed46f2e38d8344318c09 to your computer and use it in GitHub Desktop.
Save amnn/1459f884ae70ed46f2e38d8344318c09 to your computer and use it in GitHub Desktop.
module Fact where
fact :: Integer -> Integer
fact 0 = 1
fact n = n * fact (n-1)
factk :: Integer -> (Integer -> r) -> r
factk 0 k = k 1
factk n k = factk (n-1) (k . (n*))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment