Taken from http://en.wikibooks.org/wiki/Learning_Clojure:
Java includes wrapper reference types for its primitive number types, e.g. java.lang.Integer "boxes" (wraps) the primitive int type. Because every Clojure function is a JVM method expecting Object arguments, Java primitives are usually boxed in Clojure functions: when Clojure calls a Java method, a returned primitive is automatically wrapped, and any arguments to a Java method are automatically unwrapped as necessary. (However, type hinting allows non-parameter locals in Clojure functions to be unboxed primitives, which can be useful when you're trying to optimize a loop.) It looks like Clojure auto-boxes from long to Long by default: user=> (type (long 3)) java.lang.Long If you want to type hint something to primitive long you'd use #^long. For object long, use #^Long. Be warned that I'm still new at this, so I could be wrong. Travis On Jun 19, 10:55 am, BerlinBrown <berlin.br...@gmail.com> wrote: > What are the type hints on primitives. > For example, > > long abc = 3 > > is the type hint > > #^long > > or > > #^Long > > I also saw use of the java assembly? syntax before: > > #^[[L? > > or neither. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---