progs/fun/fun_llvm.sc
changeset 959 64ec1884d860
parent 958 fddf099a82f8
child 961 c0600f8b6427
--- a/progs/fun/fun_llvm.sc	Sat Dec 02 21:37:04 2023 +0000
+++ b/progs/fun/fun_llvm.sc	Wed Feb 21 09:14:12 2024 +0000
@@ -267,7 +267,7 @@
   }
 }
 
-
+print("%d\n", i)
 val prelude = """
 @.str = private constant [4 x i8] c"%d\0A\00"
 
@@ -352,16 +352,25 @@
   else factC(n - 1, x => ret(x * n))
 }
 
-factC(6, x => x)
-factC(6, x => {println(s"The final Result is $x") ; 0})
-factC(6, _ + 1)
+
 
-def fibC(n: Int, ret: Int => Int) : Int = {
-  if (n == 0 || n == 1) ret(1)
-  else fibC(n - 1, x => fibC(n - 2, y => ret(x + y)))
-}
+
 
 fibC(10, x => {println(s"Result: $x") ; 1})
 
 
 */
+factC(6, x => x)
+factC(6, x => {println(s"The final Result is $x") ; 0})
+factC(6, _ + 1)
+
+def fib(n: Int) : Int = {
+  if (n == 0 || n == 1) 1
+  else fib(n - 1) + fib(n - 2)
+}
+
+
+def fibC(n: Int, ret: Int => Int) : Int = {
+  if (n == 0 || n == 1) ret(1)
+  else fibC(n - 1, x => fibC(n - 2, y => ret(x + y)))
+}
\ No newline at end of file