On Thu, Nov 27, 2008 at 2:12 PM, Kei Suzuki <[EMAIL PROTECTED]> wrote:
>
> Any formatted print method calls like below throw
> java.lang.ClassCastException at clojure.lang.Compiler.eval.
>
> (.printf System/out "%d" 1)
> (. System/out (printf "%d" 1))
> (.format System/err java.util.Locale/US "%s" "error")
> (. System/out format nil "%s" "hello, world!\n")
>
> Am I missing something? Is it necessary to add hints that help casting
> variable args?

All those methods take Java variadic arguments, which generally means
you need build the array the method is expecting.  Fortunately, in the
cases you list you can just use the Clojure function 'format' which
does it for you:

(.println System/out (format "%d" 1))

--Chouser

--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to