From d6a34bb31a114dff8f44ed9624f25ec0de4e6c5d Mon Sep 17 00:00:00 2001 From: Ari Angga Nugraha <ari.angga@ui.ac.id> Date: Fri, 11 Dec 2020 20:23:43 +0700 Subject: [PATCH] add function to power (with recursion) --- src/Lib.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Lib.hs b/src/Lib.hs index 7e32b67..8419187 100755 --- a/src/Lib.hs +++ b/src/Lib.hs @@ -21,3 +21,6 @@ handler person context = return (Left "A person's age must be positive") countNB a b = zipWith (+) a b + +power n 1 = n +power n m = n * (power n (m-1)) -- GitLab