summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2018-07-28 17:31:03 +0000
committerrsiddharth <s@ricketyspace.net>2018-07-28 17:31:03 +0000
commit28793f1fec7cf8d371286e87276f714f77422eda (patch)
tree2b17db79fa340115005ec7ab6007918b584ef1ea /net
parentc56eecd98a88ca6e1f7f625191f6164847b24829 (diff)
Add (net ricketyspace sicp two seven).
* net/ricketyspace/sicp/two/seven.scm: New file.
Diffstat (limited to 'net')
-rw-r--r--net/ricketyspace/sicp/two/seven.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/net/ricketyspace/sicp/two/seven.scm b/net/ricketyspace/sicp/two/seven.scm
new file mode 100644
index 0000000..6b0375b
--- /dev/null
+++ b/net/ricketyspace/sicp/two/seven.scm
@@ -0,0 +1,18 @@
+;;;; Under Creative Commons Attribution-ShareAlike 4.0
+;;;; International. See
+;;;; <https://creativecommons.org/licenses/by-sa/4.0/>.
+
+(define-module (net ricketyspace sicp two seven)
+ #:export (make-interval
+ lower-bound
+ upper-bound
+ add-interval))
+
+(define (make-interval a b) (cons a b))
+
+(define (lower-bound x) (car x))
+(define (upper-bound x) (cdr x))
+
+(define (add-interval x y)
+ (make-interval (+ (lower-bound x) (lower-bound y))
+ (+ (upper-bound x) (upper-bound y))))