aboutsummaryrefslogtreecommitdiff
path: root/entries/funemy/koka
diff options
context:
space:
mode:
authorBraxton Hall2022-10-25 23:18:52 +0000
committerGitHub2022-10-25 23:18:52 +0000
commit47f320cecf3d5caf67bda5845d2230cdb9b32708 (patch)
treeddb1da2cbce7f450145c58d98271cbd90d3cb00b /entries/funemy/koka
parente187bb84b9c3231f7f63a70a3136b7355ba0567a (diff)
parenta92d2f2a96c36e758291d7150b4ff175ec2ec768 (diff)
Merge pull request #46 from funemy/main
learning koka
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))