[erlang-questions] Tuples referencing each other problem

Brady Powers powers_brady@REDACTED
Thu Sep 21 17:20:58 CEST 2017


 When I think about a data structure that needs to be traversed in both directions, I immediately think of a zipper.
https://ferd.ca/yet-another-article-on-zippers.html


It might not be appropriate, it's just where my mind goes.     On Thursday, September 21, 2017, 10:24:17 AM EDT, Grzegorz Junka <list1@REDACTED> wrote:  
 
  
Many thanks to all for your responses and suggestions.
 
To answer your question Richard, I don't actually need a cyclical structure. As I mentioned, this is a simplification of a more specific problem. I didn't want to describe all the specifics to ask a question. I need to design a tree, a variant of a HAMT tree, but which can be traversed in both directions, from the root to leafs and from leafs to the root (independently, i.e. starting from a reference to a leaf rather than recursively). Tuples that reference each other is one solution but not the only one fortunately, i.e. I can add ids to each node and use another data structure to store the mapping id-node, then store the id of the parent in the child.
 
Thank you for the pointer to the book.
 
 
GrzegorzJ
 
 
 On 18/09/2017 00:53, Richard A. O'Keefe wrote:
  
On further reflection, I suppose I should ask: 
  Why is it that you think you need cyclic structures? 
  What do you actually want to *do* with them? 
 
 As a matter of curiosity, have you read Okasaki's 
 book on functional data structures? 
 
 (Didn't someone convert Okasaki's Edison library 
 to Erlang at some point?  What happened to that?) 
 _______________________________________________ 
 erlang-questions mailing list 
 erlang-questions@REDACTED 
 http://erlang.org/mailman/listinfo/erlang-questions 
 
 
 _______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170921/a5e4e53f/attachment.htm>


More information about the erlang-questions mailing list