aboutsummaryrefslogtreecommitdiff
path: root/entries/funemy/koka
diff options
context:
space:
mode:
authorLily Lin2022-10-26 23:30:06 +0000
committerLily Lin2022-10-26 23:30:06 +0000
commitaf03b3cd051a8a8b1442147136156f271f07ac5c (patch)
tree6239bbd269f8c682fcd2bd1aecd29cc8b2edf6b5 /entries/funemy/koka
parent66fdac7a5ab7040a29fdd6a49cb0123db5ea916a (diff)
parent18d17f9fb578df5f20e689481ed06f44fcf4b80c (diff)
Merge branch 'main' into lily
Diffstat (limited to 'entries/funemy/koka')
-rw-r--r--entries/funemy/koka/fib.kk12
1 files changed, 12 insertions, 0 deletions
diff --git a/entries/funemy/koka/fib.kk b/entries/funemy/koka/fib.kk
new file mode 100644
index 0000000..5b7e66b
--- /dev/null
+++ b/entries/funemy/koka/fib.kk
@@ -0,0 +1,12 @@
+effect fib
+ ctl fib(n : int) : int
+
+fun doFib(inp : int) : div int
+ with ctl fib(n)
+ if n == 0 then 0
+ else if n == 1 then 1
+ else (doFib(n - 1) : int) + doFib(n - 2)
+ fib(inp)
+
+fun main()
+ print(doFib(20))