Basically, since vectors are immutable, you cannot easily construct that kind of recursive structure. Any means of breaking immutability would allow it, though (atoms, promises, undocumented mutable apis, mutable objects inside the vector, etc.).
To clarify: the vector itself does not explicitly prevent that, but the fact that a vector is immutable once created means that you cannot put it into itself, since you don't have it before you create it and you cannot add anything to it once it is created. That holds for any kind of immutable (and eager) data structure. On Wednesday, 10 February 2016, James Reeves <[email protected]> wrote: > No, vectors can't be recursive. However you can use a reference of some > description, e.g. > > (let [p (promise), v [p]] > (deliver p v) > v)) > > You could also use a lazy seq. > > - James > > On 10 February 2016 at 04:29, Timothy Vinick <[email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote: > >> Here's an example: >> >> vector1=[a b c d] a=[1 2 f s vector1] >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to [email protected] >> <javascript:_e(%7B%7D,'cvml','[email protected]');> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> [email protected] >> <javascript:_e(%7B%7D,'cvml','clojure%[email protected]');> >> 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 [email protected] >> <javascript:_e(%7B%7D,'cvml','clojure%[email protected]');>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');> > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > [email protected] > <javascript:_e(%7B%7D,'cvml','clojure%[email protected]');> > 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 [email protected] > <javascript:_e(%7B%7D,'cvml','clojure%[email protected]');>. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. 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 --- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
