Last active
May 24, 2016 01:19
-
-
Save malloc47/35a30b4a084c5803833032d1996cbc5f to your computer and use it in GitHub Desktop.
This file contains 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
(ns bit) | |
(defn printb | |
[n] | |
(Integer/toBinaryString n)) | |
(defn count-1s | |
[n] | |
(->> n printb (filter #{\1}) count)) | |
# bit-and bit-or bit-xor bit-not bit-flip bit-set bit-shift-right bit-shift-left bit-and-not bit-clear bit-test unsigned-bit-shift-right |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment