Todd <[email protected]> writes:
> 3. alter ref2 to have a reference (pointer) to ref1
>
> user=> (dosync (ref-set aref2 {:a aref1}))
> {:a #<r...@98adae2: {:a #<r...@7b283052: {:a #<r...@98adae2: {:a
> #<r...@7b283052: {:a #<r...@98adae2: {:a #<r...@7b283052: {:a
> #<r...@98adae2: {:a #<r...@7b283052: {:a #<r...@98adae2: {:a
> #<r...@7b283052: {:a #<r...@98adae2: {:a #<r...@7b283052: {:a
>
> <SNIP...>
>
> {:java.lang.StackOverflowError
>
> <SNIP...>
>
> 4. So, I've got a stack overflow... What's the proper way to deal with
> this? Are circular references like this not allowed?
Circular references are allowed, the problem is with the repl trying to
print them. You can set the *print-level* var to put a limit on how
deep the printer will go.
user> (set! *print-level* 8)
8
user> aref1
#<r...@64b37089: {:a #<r...@2f600492: {:a #<r...@64b37089: {:a
#<r...@2f600492: {:a #}>}>}>}>
--
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