From 28793f1fec7cf8d371286e87276f714f77422eda Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 28 Jul 2018 17:31:03 +0000 Subject: Add (net ricketyspace sicp two seven). * net/ricketyspace/sicp/two/seven.scm: New file. --- net/ricketyspace/sicp/two/seven.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 net/ricketyspace/sicp/two/seven.scm (limited to 'net') 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 +;;;; . + +(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)))) -- cgit v1.2.3