On Fri, Nov 14, 2008 at 5:19 PM, samppi <[EMAIL PROTECTED]> wrote: > > Would it be at all possible in Clojure for a collection to contain > itself? For instance: [3 2 1 [3 2 1 [...]]].
Let's try! user=> (def x [3 2 1]) #'user/x user=> x [3 2 1] Great, now append it to itself: user=> (conj x x) [3 2 1 [3 2 1]] user=> (conj x (conj x x)) [3 2 1 [3 2 1 [3 2 1]]] Since collections are immutable, you can't change an existing collection to include itself. The closest you can get is to make a new collection that contains the value of an older collection -- it may look similar, but it's not the same. So the structure will only be as deep as you make it. --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---