From 121cad7707987ac88aa760502185f8e8cdb38ef7 Mon Sep 17 00:00:00 2001 From: Tobias Eidelpes Date: Sat, 5 Nov 2022 12:51:15 +0100 Subject: [PATCH] Add exercise 2.9 --- chapter2.lisp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chapter2.lisp b/chapter2.lisp index 6a76738..f2bc972 100644 --- a/chapter2.lisp +++ b/chapter2.lisp @@ -90,3 +90,10 @@ (make-interval (- (lower-bound b) (lower-bound a)) (- (upper-bound b) (upper-bound a)))) +;; Exercise 2.9 +(defun width-interval (x) + "Calculate width of an interval as half of the distance between lower +and upper bound." + (/ (- (upper-bound x) (lower-bound x)) + 2.0)) +