Browse Source

Merge files t1 and myfibo

Add the slide number too
DricomDragon 5 years ago
parent
commit
0709199f7f
2 changed files with 15 additions and 8 deletions
  1. 15 0
      myfibo.hs
  2. 0 8
      t1.hs

+ 15 - 0
myfibo.hs

@@ -1,3 +1,18 @@
+-- Slide 15
+
+
+-- Fibonacci recursive
+
 fibo 0 = 1
 fibo 1 = 1
+
 fibo n = fibo (n - 2) + fibo (n - 1)
+
+
+-- Fibonacci terminal
+
+f n = ft n 1
+
+ft n acc = case n of
+	0 -> acc
+	_ -> ft (n - 1) (acc * n)

+ 0 - 8
t1.hs

@@ -1,8 +0,0 @@
-f n = ft n 1
-
-ft n acc = case n of
-	0 -> acc
-	_ -> ft (n - 1) (acc * n)
-
-main :: IO ()
-main = print ( f 5 )