[ create a new paste ] login | about

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

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

fn2 f = \x -> if (x == 0 || x == 1) then x else f (x-1) + f (x-2)
fpc f = f (fpc f)

fibonacci = fpc fn2

main = print (fibonacci 4) 


Output:
1
3


Create a new paste based on this one


Comments: