Jump to content

Ethiopian multiplication: Difference between revisions

typo fix in CL multiple/multiply
(CL Ethiopian Multiply)
(typo fix in CL multiple/multiply)
Line 200:
=={{header|Common Lisp}}==
 
Common Lisp already has <code>evenp</code>, but all three of <code>halve</code>, <code>double</code>, and <code>even-p</code> are locally defined within <code>ethiopian-multiplemultiply</code>. (Note that the termination condition is <code>(zerop l)</code> because we terminate 'after' the iteration wherein the left column contains 1, and <code>(halve 1)</code> is 0.)
 
<lang lisp>(defun ethiopian-multiply (l r)
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.