Horner's rule for polynomial evaluation: Difference between revisions

→‎{{header|Common Lisp}}: to make it work with empty lists too
(→‎{{header|Common Lisp}}: #' is not needed on lambda. Let's not make Lisp look unnecessarily complicated!)
(→‎{{header|Common Lisp}}: to make it work with empty lists too)
Line 178:
<lang lisp>(defun horner (coeffs x)
(reduce (lambda (coef acc) (+ (* acc x) coef))
coeffs :from-end t :initial-value 0))</lang>
 
=={{header|D}}==
Anonymous user