You can cast to primitive int with (int ...) On Sun, Jun 10, 2012 at 1:53 PM, Jim - FooBar(); <jimpil1...@gmail.com>wrote:
> On 10/06/12 18:43, Ben Smith-Mannschott wrote: > >> "can accept ints or doubles" >> >> How is the Clojure compiler to know wether to compile a call to >> Point.setLocation(double,**double) or Point.setLocation(int,int)? >> >> I think you need to tell the compiler the types of (first np) and >> (second np), which means -- of course -- that you'll need to know >> what they are statically. >> >> I'm a little rusty on my type hinting, but have you tried something >> like: >> >> (.position setLocation ^double (first np) ^double (second np)) >> or >> (.position setLocation ^int (first np) ^int (second np)) >> >> // ben >> > > Yep, it works...only 2 warnings now! btw, you can't have int primitive > type-hinting - only double or long. > > > Jim > > -- > 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+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/**group/clojure?hl=en<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