Re: Byte Literals
Ah, right. Thanks. I'm not keeping up with my Clojure version numbers... On Sep 24, 2010, at 1:52 AM, Rasmus Svensson wrote: > There's also 'bytes', 'byte-array' and 'into-array': > > (byte-array (map byte [1 2 3])) > (into-array Byte/TYPE (map byte [1 2 3])) > > // raek > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Byte Literals
There's also 'bytes', 'byte-array' and 'into-array': (byte-array (map byte [1 2 3])) (into-array Byte/TYPE (map byte [1 2 3])) // raek -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Byte Literals
I'm not quite sure what you're asking. Clojure doesn't have byte literals, but you can use the function 'byte' to coerce an int literal: (map class [2 3 4]) => (java.lang.Integer java.lang.Integer java.lang.Integer) (map class (map byte [2 3 4])) => (java.lang.Byte java.lang.Byte java.lang.Byte) Or you can create a Java byte[] array: (def a (make-array Byte/TYPE 3)) But you still have to coerce: (aset a 0 (byte 2)) => 2 (aset a 0 2) => java.lang.IllegalArgumentException: argument type mismatch (NO_SOURCE_FILE:0) Have all good days, David Sletten On Sep 24, 2010, at 12:31 AM, HiHeelHottie wrote: > > Is there a way to create a vector of byte literals eg. [64 69 72] as > bytes? > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Byte Literals
Is there a way to create a vector of byte literals eg. [64 69 72] as bytes? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en