summaryrefslogtreecommitdiffstats
path: root/net/ricketyspace
diff options
context:
space:
mode:
Diffstat (limited to 'net/ricketyspace')
-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))))