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

bytes

clojure.core

  • (bytes xs)
Casts to bytes[]

1 Example top

  • ;; for fast interop
    user=> (bytes (byte-array (map (comp byte int) "ascii")))
    #<byte[] [B@7a004f62>
    user=> (def the-bytes *1)
    #'user/the-bytes
    user=> (defn get-byte [the-bytes i] (aget the-bytes i))
    #'user/get-byte Reflection warning, NO_SOURCE_PATH:1 - call to aget can't be resolved.
    
    user=> (defn get-byte [the-bytes i] 
             (let [the-bytes (bytes the-bytes)] 
               (aget the-bytes i)))
    #'user/get-byte
    user=> (get-byte the-bytes 0)
    97
    
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:4212 top

(definline bytes
  "Casts to bytes[]"
  {:added "1.1"}
  [xs] `(. clojure.lang.Numbers bytes ~xs))
Vars in clojure.core/bytes: definline concat list seq
Used in 1 other vars bytes

Comments top

No comments for bytes. Log in to add a comment.