Re: Clojure type of Java array

2012-07-01 Thread Adam Esterline
Try... (.isArray (type (.toCharArray "Clojure"))) => true On Sunday, July 1, 2012 9:35:38 AM UTC-6, Warren Lynn wrote: > > Somebody asks me to add handling of Java array in clj-cc/last. But I am > confused what will be the type of Java array in Clojure. Fox example: > > (type (.toCharArray "Cloj

Re: Clojure type of Java array

2012-07-01 Thread Warren Lynn
The idea of dynamic protocol extension on types is very cool. I use that in adding support of Java arrays in 'last'. Thank you. On Sunday, July 1, 2012 1:20:24 PM UTC-4, David Nolen wrote: > > The set of Java array types is open. You can however extend array > classes as you encounter them at ru

Re: Clojure type of Java array

2012-07-01 Thread David Nolen
The set of Java array types is open. You can however extend array classes as you encounter them at runtime. http://dosync.posterous.com/51626638 David On Sun, Jul 1, 2012 at 1:17 PM, Warren Lynn wrote: > > So if I want to extend a protocol to all Java arrays, is there a single type > I can use?

Re: Clojure type of Java array

2012-07-01 Thread Warren Lynn
So if I want to extend a protocol to all Java arrays, is there a single type I can use? Sounds like not. So I need to extend the protocols to char arrays, int arrays and etc? On Sunday, July 1, 2012 12:20:19 PM UTC-4, dennis wrote: > > (type (.toCharArray "Clojure")) is a class, [C means an a

Re: Clojure type of Java array

2012-07-01 Thread David Nolen
If you want to check if something is an array: (.. x getClass isArray) David On Sun, Jul 1, 2012 at 11:35 AM, Warren Lynn wrote: > Somebody asks me to add handling of Java array in clj-cc/last. But I am > confused what will be the type of Java array in Clojure. Fox example: > > (type (.toCharAr

Clojure type of Java array

2012-07-01 Thread Warren Lynn
Somebody asks me to add handling of Java array in clj-cc/last. But I am confused what will be the type of Java array in Clojure. Fox example: (type (.toCharArray "Clojure")) => [C ;; Note: it looks like garbage. but that is what I actually got (isa? (type (.toCharArray "Clojure")) j