sicp

sicp sandbox.
git clone git://git.ricketyspace.net/sicp.git
Log | Files | Refs

commit 0b8a4c4eb921bf28c6800140562343bde220aab2
parent a394d0140222bb7939cbcf3f27f2ad6ca0b7f1d7
Author: rsiddharth <s@ricketyspace.net>
Date:   Wed, 17 Aug 2016 02:24:33 +0000

add one/eleven.scm

* one/eleven.scm (recursive-fn): add function.

Diffstat:
one/eleven.scm | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/one/eleven.scm b/one/eleven.scm @@ -0,0 +1,12 @@ +;;; Under Creative Commons Attribution-ShareAlike 4.0 +;;; International. See +;;; <https://creativecommons.org/licenses/by-sa/4.0/>. + +(define-module (one eleven) + #:export (recursive-fn)) + +(define (recursive-fn n) + (cond ((<= n 3) n) + (else (+ (* 1 (recursive-fn (- n 1))) + (* 2 (recursive-fn (- n 2))) + (* 3 (recursive-fn (- n 3)))))))