Or use destructuring: (let [[x y z] [1 2 3 4]] (.setOrigin x y z))
I myself would always prefer this method as it describes gives the elements in the vector a structure. See [1] for a blog post about this. [1]: http://tech.puredanger.com/2011/10/12/2-is-a-smell/ On Sat, Jun 23, 2012 at 12:09 PM, Vinzent <ru.vinz...@gmail.com> wrote: > You're passing one argument, a list contaning 3 elements, instead of 3 > arguments. Try this (by the way, you can omit nth call): > > (.SetOrigin cone (v 0) (v 2) (v 3)) > > Another option (not really relevant in this particular case) is to use > memfn: > > (apply (memfn SetOrigin) cone [2 4 6]) > > суббота, 23 июня 2012 г., 15:33:23 UTC+6 пользователь Antonio Recio написал: >> >> I have an object called cone. I can change the origin of the cone with >> this: >> (.SetOrigin cone 1 1 1) >> >> I have a vector called v >> (def v [2 4 6 8]) >> >> And I would like to take 3 elements of the vector v and to set to the >> origin of the cone. But when I write this I obtain an error: >> (.SetOrigin cone (list (nth v 0) (nth v 2)(nth v 3))) >> ;=> #<ClassCastException java.lang.ClassCastException: Cannot cast >> clojure.lang.PersistentList to [D> >> >> What I am doing wrong? >> > -- > 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 -- Moritz Ulrich -- 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