aboutsummaryrefslogtreecommitdiff
path: root/entries/funemy/koka/fib.kk
diff options
context:
space:
mode:
authorfunemy2022-10-25 23:00:17 +0000
committerfunemy2022-10-25 23:00:17 +0000
commit0269509a887fb154f32b88f5dfbeb883e16f628c (patch)
tree2b84af92ed3a0cbaf069438876a29a1cb8e7c7be /entries/funemy/koka/fib.kk
parentcdec98dc53617c3ad5c297f8f5d127013c111b6d (diff)
learning new language
Diffstat (limited to 'entries/funemy/koka/fib.kk')
-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))