hmmm, seems like you, me and rayne all fail to handle the overlapping node case correctly. this is the best solution i've come up with that actually seems to work:
(apply merge-with concat {} (for [nd d nd-pair nd face nd-pair] {face (list nd)})) try it with d set to this: [d [#{#{1 2} #{3 5}} #{#{1 2} #{3 4}} #{#{5 6} #{7 8}}]] On Dec 3, 2:00 pm, George Jahad <cloj...@blackbirdsystems.net> wrote: > Actually my solution is wrong! It works for this particular example, > but not if there are nodes with overlapping values. > Doh! > > My main point was just that "into" is a under used gem, that I wanted > to publicize a bit. Next time I'll try to find an example that is > actually correct! > > On Dec 3, 12:46 pm, Laurent PETIT <laurent.pe...@gmail.com> wrote: > > > Yes, > > > though I've always found 'into a little bit too magical for me. > > For example, I find it hard to follow the doc to see what 'adding' will mean > > for maps. > > > 2010/12/3 George Jahad <cloj...@blackbirdsystems.net> > > > > > (apply > > > > merge-with > > > > conj > > > > {} > > > > (for [nd d nd-pair nd face nd-pair] > > > > {face nd})) > > > > I like to use into for cases like this: > > > > (into {} (for [nd d nd-pair nd face nd-pair] [face nd])) > > > > seems clearer to me. > > > > g > > > > -- > > > 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<clojure%2bunsubscr...@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 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