program. 平方和函数 energy 的定义[lp-scheme-energy]

(define (energy xs)
   (let loop ((remaining (squares xs)) (total 0))
     (if (null? remaining)
         total
         (loop (cdr remaining) (+ total (car remaining))))))