On Wednesday, March 31, 2010, Richard Newman <holyg...@gmail.com> wrote:
>
> ur=> (map #(Integer/parseInt % 16) ["ff43" "0032"])
> (65347 50)
>
>
> ...that yields ints, not shorts.
>
>
> At the risk of diverging from the question: why are you concerned with the 
> specific type of the number?

I am because the OP was.  He asked for shorts; I was just trying to
oblige.  Regardless of actual storage size requirements, short and int
are distinct types, at least in Java-land, and not knowing the problem
space I assume there was a reason for wanting one instead of the
other.

> On a related note: if I have the symbol for a type, like "short" or
> "int" or "byte",  is there a way to ask Clojure what size word that
> represents?

> In Java, byte/char/short/int are all represented the same: 32 bits. Long is 
> 64.

Forget the storage cell size;  I want to know the range of legal
values.  Obviously I can define my own mapping, but I was asking if
there was anything built in to Clojure.

> If you mean "how many octets would this take to represent in C":

C storage has nothing to do with it.  In Clojure 1.2, (short n) blows
up on n < -32768 or n > 32767.  I would like a way to programmatically
determine those values based on the identity of the function I'm about
to call.  Again, I can obviously make a lookup table; just thought
there might be something introspectable.



-- 
Mark J. Reed <markjr...@gmail.com>

-- 
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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to