Ethiopian multiplication: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 191: | Line 191: | ||
=={{header|Haskell}}== |
=={{header|Haskell}}== |
||
<lang haskell>ethiopicmult 1 pliand acc = acc + pliand |
<lang haskell>ethiopicmult 1 pliand acc = acc + pliand |
||
ethiopicmult plier pliand acc |
ethiopicmult plier pliand acc |
||
| even plier = ethiopicmult (plier `div` 2) (pliand * 2) acc |
|||
| otherwise = ethiopicmult (plier `div` 2) (pliand * 2) (acc + pliand)</lang> |
|||
else ethiopicmult (plier `div` 2) (pliand * 2) (acc + pliand)</lang> |
|||
'''Usage example''' from the interpreter |
'''Usage example''' from the interpreter |