From ea6a6b914f2d4d79a5cc819e1e29d461e9a211f3 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 3 Feb 2018 05:39:35 +0000 Subject: Add net/ricketyspace/sicp/one/thirtyeight.scm. --- net/ricketyspace/sicp/one/thirtyeight.scm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 net/ricketyspace/sicp/one/thirtyeight.scm diff --git a/net/ricketyspace/sicp/one/thirtyeight.scm b/net/ricketyspace/sicp/one/thirtyeight.scm new file mode 100644 index 0000000..be5288a --- /dev/null +++ b/net/ricketyspace/sicp/one/thirtyeight.scm @@ -0,0 +1,19 @@ +;;;; Under Creative Commons Attribution-ShareAlike 4.0 +;;;; International. See +;;;; . + +(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 -- cgit v1.2.3