From f387a3acb16001fe23923503b9398fd2dc7b3e18 Mon Sep 17 00:00:00 2001 From: LeonardoBizzoni Date: Fri, 6 Sep 2024 16:32:48 +0200 Subject: [PATCH] Forgot to update README --- README.org | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/README.org b/README.org index 72f554d..f93cec6 100755 --- a/README.org +++ b/README.org @@ -1,3 +1,5 @@ +#+AUTHOR: Leonardo Bizzoni + * Running it #+begin_src git clone https://github.com/LeonardoBizzoni/LBPL.git @@ -9,19 +11,19 @@ make #+end_src * Example script -#+begin_src +#+begin_src lbpl :tangle main.lbpl fn fib(n) { - return fibIter(n, 0, 1); -} - -fn fibIter(n, curr, next) { - if (n == 0) { - return curr; - } else if (n == 1) { - return next; - } else { - return fibIter(n - 1, next, curr + next); + fn fibIter(n, curr, next) { + if (n == 0) { + return curr; + } else if (n == 1) { + return next; + } else { + return fibIter(n - 1, next, curr + next); + } } + + return fibIter(n, 0, 1); } class Prova { @@ -33,7 +35,9 @@ class Prova { } runtime() { - println("fib("+ this.n +") = "+ this.fib_n + " runtime: " + + println("fib("+ this.n +") = " + + this.fib_n + + " runtime: " + (this.end - this.start)); } } -- 2.52.0