From 39d48f34f461a27488e9609f1914efc9dbccf3f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20Kapri=C5=A1?= Date: Sun, 9 Mar 2025 14:13:33 +0100 Subject: [PATCH] Fix inaccurate comment in exercise 2.57 --- ex-2.57.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ex-2.57.scm b/ex-2.57.scm index bb2c91a..e38118e 100644 --- a/ex-2.57.scm +++ b/ex-2.57.scm @@ -20,10 +20,10 @@ (filter predicate (cdr sequence)))) (else (filter predicate (cdr sequence))))) -; only folds the beginning constants of the top-level expression -; e.g. (+ 2 3 5 x) becomes (+ 10 x) +; folds the constants of the top-level expression +; e.g. (+ 2 3 x 5) becomes (+ 10 x) ; (+ x y z) -> (+ x y z) -; (* 2 0 3 x) -> 0 +; (* 2 x 0 3) -> 0 ; (+ 3 -3 x) -> x (define (fold exp) (if (and (not (sum? exp)) (not (product? exp))) @@ -117,4 +117,4 @@ (deriv (base exp) var)) (error "non-constant exponents not yet supported: DERIV" exp))) (else - (error "unknown expression type: DERIV" exp)))) \ No newline at end of file + (error "unknown expression type: DERIV" exp))))