bit-set

clojure.core

  • (bit-set x n)
Set bit at index n

1 Example top

  • user=> (bit-set 2r1011 2) ; index is 0-based
    15 
    ;; 15 = 2r1111
    
    
    ;; the same in decimal
    user=> (bit-set 11 2) 
    15 
    
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:1272 top

(defn bit-set
  "Set bit at index n"
  {:added "1.0"
   :static true}
  [x n] (. clojure.lang.Numbers setBit x n))
Vars in clojure.core/bit-set:
Used in 0 other vars

Comments top

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