transcendental-lisp/lisp/compound.lisp

15 lines
367 B
Common Lisp

(defun compound (principal interest-rate years)
(cond
((= years 0) principal)
(t (let ( (previous-principal (compound principal interest-rate (- years 1))) )
(+ previous-principal
(/ (+ (* previous-principal
interest-rate)
50)
100)
)
)
)
)
)