Created
August 18, 2017 03:52
-
-
Save Sophia-Gold/aa2d2782e92f9e2c29d12976d3b731d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defn halve [i] | |
| (bit-shift-right i 1)) | |
| (defn double [i] | |
| (bit-shift-left i 1)) | |
| (defn mul [x y] | |
| (let [x (take-while #(not= % 0) (iterate halve x))] | |
| (->> y | |
| (iterate double) | |
| (take (count x)) | |
| (map #(if (odd? %1) %2 0) x) | |
| (reduce + 0)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment