(side note: what is different between Long/MAX_VALUE and the
function call (Long/MAX_VALUE)?
None. Both are syntax sugar for (. Long MAX_VALUE)
It seems like unchecked-multiply doesn't like vars, but thats surprising.
What am I doing wrong here?
unchecked-multiply only does unchecked
2011/12/5 Stuart Sierra the.stuart.sie...@gmail.com
(side note: what is different between Long/MAX_VALUE and the
function call (Long/MAX_VALUE)?
None. Both are syntax sugar for (. Long MAX_VALUE)
It seems like unchecked-multiply doesn't like vars, but thats surprising.
What am I
You can't store primitives in vars. But you can cast their contents to
primitives with (long ...) (int ...) etc
David
On Mon, Dec 5, 2011 at 12:16 PM, Linus Ericsson
oscarlinuserics...@gmail.com wrote:
2011/12/5 Stuart Sierra the.stuart.sie...@gmail.com
(side note: what is different
David and Stu to the rescue. Of course that's the way to do it.
Thank you both,
/Linus
2011/12/5 David Nolen dnolen.li...@gmail.com
You can't store primitives in vars. But you can cast their contents to
primitives with (long ...) (int ...) etc
David
On Mon, Dec 5, 2011 at 12:16 PM, Linus
On Mon, Dec 5, 2011 at 5:29 PM, Linus Ericsson oscarlinuserics...@gmail.com
wrote:
David and Stu to the rescue. Of course that's the way to do it.
Not sure if this is what you want, but Clojure 1.3 introduced ^:const.
This lets you store a primitive constant value:
(def ^:const hash
Thats a great feature as well! It is very good not to clutter the code with
magic constants, but to be able to name them in a sane way.
Thank you all again,
/Linus
Den 5 dec 2011 18:38 skrev David Powell djpow...@djpowell.net:
On Mon, Dec 5, 2011 at 5:29 PM, Linus Ericsson
I try to do multiplication where overflowing is expected and the result
should be handled modulo ie the multiplication results in a truncated
long.
user (unchecked-multiply (Long/MAX_VALUE) (Long/MAX_VALUE))
1 ;;is ok and expected
also
classificator.fnvhash (unchecked-multiply Long/MAX_VALUE