(define (accumulate pos-list null-value operator)
  (let loop
    ((current (first pos-list))
     (old-res null-value))
    (let ((res (operator old-res (peek pos-list current))))
      (if (has-next? pos-list current)
          (loop (next pos-list current) res)
          res))))