sicp

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

commit ea6a6b914f2d4d79a5cc819e1e29d461e9a211f3
parent 7ada55caede65cf32d53ab00060aed16abb7605e
Author: rsiddharth <s@ricketyspace.net>
Date:   Sat,  3 Feb 2018 05:39:35 +0000

Add net/ricketyspace/sicp/one/thirtyeight.scm.

Diffstat:
net/ricketyspace/sicp/one/thirtyeight.scm | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/net/ricketyspace/sicp/one/thirtyeight.scm b/net/ricketyspace/sicp/one/thirtyeight.scm @@ -0,0 +1,19 @@ +;;;; Under Creative Commons Attribution-ShareAlike 4.0 +;;;; International. See +;;;; <https://creativecommons.org/licenses/by-sa/4.0/>. + +(define-module (net ricketyspace sicp one thirtyeight) + #:use-module (net ricketyspace sicp one thirtyseven) + #:export (euler-minus-2)) + +(define (euler-minus-2) + (define (n i) 1.0) + (define (d i) (cond ((= i 1) 1) + ((= (remainder i 3) 2) (* (+ (quotient i 3) 1) 2)) + (else 1))) + (cont-frac-rec n d 21)) + +;;; Guile REPL +;;; scheme@(guile-user)> ,use (net ricketyspace sicp one thirtyeight) +;;; scheme@(guile-user)> (euler-minus-2) +;;; $25 = 0.7182818284590453