On Fri, Nov 28, 2008 at 2:59 AM, Kei Suzuki <[EMAIL PROTECTED]> wrote:
>
> On Nov 27, 11:21 am, Chouser <[EMAIL PROTECTED]> wrote:
[...]
>> 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))
[...]
> Got it. So these also work and are close to what I really wanted to
> do.
>
> (.printf System/out Locale/US "%-10.4f\n" (to-array [Math/PI]))
> (.printf System/out Locale/FRANCE "%-10.4f\n" (to-array [Math/PI]))
[...]

I think Chouser's way of doing this looks less ugly:

(.println System/out (format "%.4f" Math/PI))

I don't see a reasonable way to incorporate Locale/US etc. in there, though.

Is there any way Clojure could automatically convert:

(.printf System/out Locale/US "%-10.4f\n" Math/PI)

to:

(.printf System/out Locale/US "%-10.4f\n" (to-array [Math/PI]))

because it's a method that takes variadic args?  Or would it have to guess?

-- 
Michael Wood <[EMAIL PROTECTED]>

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