Hi, On Wed, Nov 25, 2009 at 9:01 AM, cej38 <junkerme...@gmail.com> wrote:
> Hi, > I am sorry if this has already discussed, but I didn't see it when I > did a search. > I keep running into instances where I would like to define a struct, > using defstruct, and then have that be applied to the elements of a > coll. A simple example might explain it better. > > (defstruct mystruct :A :B :C :D) > > (def somecoll ["abcd" 5 6.2 [1 2 3]]) > > So far the only way I have been able to get this to work is to do > something that is rather awkward. > > (struct mystruct (first somecoll) (second somecoll) (nth somecoll 2) > (last somecoll)) > > Is there a better way of doing this? For example, something like: > > (apply-struct-coll mystruct mycoll) > (apply struct mystruct mycoll) works well. Christophe -- 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