https://github.com/Helium4Haskell/lvm
Raw File
Tip revision: af88819679f8853d65340d9b0faec42d975ffd9d authored by no_author on 12 November 2001, 11:30:05 UTC
This commit was manufactured by cvs2svn to create branch 'daan'.
Tip revision: af88819
nfib.core
module NFib where

import LvmLang

data List a = Nil | Cons a (List a)

map f xs
  = case xs of
      Nil -> Nil
      Cons x xx -> Cons (f x) (map f xx)


main  = nfib 27

-- normal nfib
nfib n = case n of
          0  -> 1
          1  -> 1
          n  -> (+) 1 ((+) (nfib ((-) n 1)) (nfib ((-) n 2)))
back to top