On Sat, Feb 7, 2009 at 5:29 AM, Kevin Albrecht <onlya...@gmail.com> wrote:
>
> Why is this happening?
>
> (def cs (make-array Character/TYPE 1024))
>
> (apply str cs)
> -> ""
>
> (String/valueOf cs)
> -> "[...@42880d"
>
> Shouldn't these return the same value?

Your "cs" var have type Object and therefor hits the generc
String.valueOf(Object) overload.

You can fix it with typehints:

user=> (def #^{:tag "[C"} cs (.toCharArray "abc"))
#'user/cs
user=> (String/valueOf cs)
"abc"

>
> --Kevin
> >
>



-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.

--~--~---------~--~----~------------~-------~--~----~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to