This also means that the source code for clojure.core/format is a good
study on how to make use of Java vararg methods:

  (defn format
    "Formats a string using java.lang.String.format, see
java.util.Formatter for format
    string syntax"
    {:tag String}
    [fmt & args]
    (String/format fmt (to-array args)))


On Feb 17, 12:41 pm, Kevin Downey <redc...@gmail.com> wrote:
> the [ in front means an array. the String.format takes java varargs,
> which the compiler de-sugars as an array. easier to use clojure's own
> format function. which calls String's format method in the end, but
> you don't have to create the array manually.
>
>
>
>
>
> On Wed, Feb 17, 2010 at 9:21 AM, Phil <verisimilid...@gmail.com> wrote:
> > Sorry for the newbie question, but this seems a strange error
> > message.  Either it is saying that a java.lang.Integer cannot be cast
> > to an Object, or it is saying that it can't be cast to a particular
> > object.  Some enlightenment would be appreciated.
>
> > user=> (. String format "%d" 28)
> > java.lang.ClassCastException: java.lang.Integer cannot be cast to
> > [Ljava.lang.Object; (NO_SOURCE_FILE:0)
>
> > --
> > 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
>
> --
> And what is good, Phaedrus,
> And what is not good—
> Need we ask anyone to tell us these things?

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

Reply via email to