Fix inaccurate comment in exercise 2.57

This commit is contained in:
Petar Kapriš 2025-03-09 14:13:33 +01:00
parent f5131b16db
commit 39d48f34f4

View file

@ -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))))
(error "unknown expression type: DERIV" exp))))