From 8efb37fdfdfdf94d5f7aae49c2464bc67355ba15 Mon Sep 17 00:00:00 2001
From: Ari Angga Nugraha <ari.angga@ui.ac.id>
Date: Sat, 12 Dec 2020 21:52:12 +0700
Subject: [PATCH] add function to count factorpresentvalue

---
 src/Lib.hs | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/Lib.hs b/src/Lib.hs
index 0f0dc98..11a599a 100755
--- a/src/Lib.hs
+++ b/src/Lib.hs
@@ -20,17 +20,20 @@ handler person context =
   else
     return (Left "A person's age must be positive")
 
+interest = 0.2
+
 -- recursion
 power n 1 = n
 power n m = n * (power n (m-1))
 
 -- high order function
-netcashflow income outcome = zipWith (-) income outcome
+-- netcashflow income outcome = zipWith (-) income outcome
+-- currying
+netcashflow = zipWith (-)
 
 -- recursion
 powervalue m = 1 / (power (1 + interest) m)
 
--- currying (variable nya bisa hilang)
--- factorpresentvalue ns = map powervalue ns
--- ns nya bisa dihilangkan
-factorpresentvalue = map powervalue
+-- anonymus function
+factorpresentvalue = map (\x -> powervalue x) [1..5]
+
-- 
GitLab