Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

35 lines (28 sloc) 0.563 kb
module Main where
fac :: Integer -> Integer
fac 1 = 1
fac n = n * fac (n - 1)
fac' :: Integer -> Integer
fac' n =
case n of
1 -> 1
_ -> n * fac (n - 1)
fac'' :: Integer -> Integer
fac'' n
| n <= 1 = 1
| otherwise = n * fac (n - 1)
fac''' :: Integer -> Integer
fac''' n =
if n <= 1
then 1
else n * fac (n - 1)
facs = 1 : go 2
where go :: Integer -> [Integer]
go n = n : map (* n) (go (n + 1))
fib :: Integer -> Integer
fib 0 = 0
fib 1 = 1
fib n =
let r = fib $ n - 1
r' = fib $ n - 2
in r + r'
Jump to Line
Something went wrong with that request. Please try again.