summaryrefslogtreecommitdiffstats
path: root/net/ricketyspace
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2018-02-03 05:39:35 +0000
committerrsiddharth <s@ricketyspace.net>2018-02-03 05:39:35 +0000
commitea6a6b914f2d4d79a5cc819e1e29d461e9a211f3 (patch)
tree8d40b431c1e528c7d008cd897b676c348b6851c9 /net/ricketyspace
parent7ada55caede65cf32d53ab00060aed16abb7605e (diff)
Add net/ricketyspace/sicp/one/thirtyeight.scm.
Diffstat (limited to 'net/ricketyspace')
-rw-r--r--net/ricketyspace/sicp/one/thirtyeight.scm19
1 files changed, 19 insertions, 0 deletions
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
+;;;; <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