You're viewing version 1.2.0 of bit-and. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

bit-and

clojure.core

  • (bit-and x y)
Bitwise and

3 Examples top

  • user=> (bit-and 2r1100 2r1001)
    8
    ;; 8 = 2r1000
    
    ;; the same in decimal
    user=> (bit-and 12 9)
    8
  • user> (bit-and 0x08 0xFF)
    8
  • user=> (Integer/toBinaryString 235)
    "11101011"
    user=> (Integer/toBinaryString 199)
    "11000111"
    user=> (bit-and 235 199)
    195
    user=> (Integer/toBinaryString 195)
    "11000011"
    
    ;;11101011
    ;;&
    ;;11000111
    ;;=
    ;;11000011
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:1031 top

(defn bit-and
  "Bitwise and"
   {:inline (fn [x y] `(. clojure.lang.Numbers (and ~x ~y)))
    :added "1.0"}
  [x y] (. clojure.lang.Numbers and x y))
Vars in clojure.core/bit-and: and defn
Used in 1 other vars even?

Comments top

No comments for bit-and. Log in to add a comment.