Quoting for small example like I mention is not an issue, but in general, I 
need to pass an vector or list, since that's what I get, in which case I 
cannot quote. 

On Tuesday, January 26, 2016 at 3:52:17 PM UTC-6, Michael Willis wrote:
>
> What's not practical about quoting?  I thought it was considered more 
> idiomatic than doing (list ...)
>
> On Sunday, January 17, 2016 at 2:48:29 PM UTC-6, Ritchie Cai wrote:
>>
>> Hi all,
>>
>> I'm trying to create a Java ArrayList object from a Clojure collection to 
>> pass to another Java API. I get reflection warnings when the elements are 
>> not primitive types, in this case I'm using SparseIndexedVector class 
>> from vectorz library.
>>
>> (ArrayList. [c0 c1 c2])
>> Reflection warning, *cider-repl localhost*:77:11 - call to 
>> java.util.ArrayList ctor can't be resolved.
>>
>> where c0 c1 c2 are of type SparseIndexedVector. Alternatively, I can 
>> create create ArrayList then add elements one by one in a loop.
>>
>> (doto (ArrayList.)
>>    (.add c0)
>>    (.add c1)
>>    (.add c2))
>>
>> But I'm wondering if there is away to get rid of the the reflection 
>> warning when calling ArrayList constructor. 
>>
>> Also, quoting a list will not give reflection warning:
>>
>> (ArrayList. '(c0 c1 c2))  ;; no warning
>>
>> (ArrayList. (list c0 c1 c2)) 
>> Reflection warning, *cider-repl localhost*:77:11 - call to 
>> java.util.ArrayList ctor can't be resolved.
>>
>> However, quoting is not very practical.
>>
>> Thanks
>> Ritchie
>>
>>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to