In porting my modelling library Cells to Clojure I managed to get a stack overflow when the printer tried to print a recursive data structure* I have used in the Common Lisp version.* Basically, a ref holds a map in which some values are maps in which some values are the ref.In Lisp we have *print-depth* as well as *print-length* to deal with just this case.Is there some way I can deal with this, or are recursive data structures not really supported by Clojure?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
- James
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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 a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/TGtavJVzVWk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.
But we should mention that recursive data structures that contain refs are a bit of a code-smell. Your structures are no longer immutable if they contain refs which are mutable containers for immutable data. Something to think about.
You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/TGtavJVzVWk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.
>> I understand, but this library is all about state because it is about modelling long-lived entities over time as an unpredictable stream of events act on the model.No reason why that can't be handled as a graph of nodes + a single atom. That's how you would model this in something like Loom (https://github.com/aysylu/loom), and how I model all my dataflow graphs. Start creating recursive self-referencing data structures you're in for a world of hurt.