Anonymous user
Horner's rule for polynomial evaluation: Difference between revisions
Horner's rule for polynomial evaluation (view source)
Revision as of 08:51, 23 September 2011
, 12 years ago→{{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}}==
|