私はsicpに取り組んでおり、accumulateを使用して「最後の」関数を書き込もうとしています。
(define (accumulate f x xs)
(if (null? xs)
x
(f (car xs)
(accumulate f x (cdr xs)))))
(last '(1 2 3 4 5)) ;;=> (5)
これを試しましたが、機能しません
(define (last seq)
(accumulate (lambda (x y) x)
'()
seq))