Anonymous user
Ethiopian multiplication: Difference between revisions
Added Ela
(Added Ela) |
|||
Line 796:
return ab
}</lang>
=={{header|Ela}}==
Translation of Haskell:
<lang ela>open Core
let halve = (/2)
let double = (*2)
let odd = (==1) << (%2)
let ethiopicmult a b = sum <| map snd <| filter (odd << fst) <| zip
(takeWhile (>=1) <| iterate halve a)
(iterate double b)
ethiopicmult 17 34</lang>
Output:
<pre>578</pre>
=={{header|Erlang}}==
|