[ create a new paste ] login | about

Link: http://codepad.org/uGjfg5Jb    [ raw code | output | fork ]

johannes - Haskell, pasted on Aug 7:
1
2
3
4
5
6
7
8
module Main where

fn f = \x -> if (x == 0) then 1 else x * f (x - 1)

fpc f = f (fpc f)
factorial = fpc fn

main = print (factorial 4)


Output:
1
24


Create a new paste based on this one


Comments: