summaryrefslogtreecommitdiff
path: root/coding-exercises/2/34.rkt
blob: 58500494c42b442c4b476ae16e2b54631a9b78e0 (plain)
1
2
3
4
5
6
7
8
9
10
#lang racket
(require "../../shared/lists.rkt")

(define (horner-eval x coefficient-sequence)
  (accumulate (lambda (this-coeff higher-terms)
                (+ this-coeff (* x higher-terms)))
              0
              coefficient-sequence))
((lambda ()
   (horner-eval 2 (list 1 3 0 5 0 1))))