{
 "blyg": "0.4",
 "id": "2y9sw536ks0zej7r33d9vxrz17",
 "kind": "thread",
 "origin": "https://notionparallax.co.uk/",
 "page": "https://notionparallax.co.uk/2009/lists-to-trees",
 "author": {
  "name": "Ben Doherty",
  "url": "https://notionparallax.co.uk/"
 },
 "created": "2009-03-01T15:08:22Z",
 "updated": "2009-03-01T15:08:22Z",
 "version": 1,
 "content_md": "# lists to trees\n\n\nGennaro asked me about data structures to contain a tree for his genetic programming in GC (little does he know how clueless I am about data structures), and I recommended a nested list.\n\nIt seemed sensible to me, so I set about turning a nested list into a tree diagram, and I have to admit that there were moments that I doubted the plausibility of it, but it turned out OK in the end!\n\nThe way to look at it seems to be that you work from the outside in. The outside set of brackets is the root, and then everything inside that is a terminal, with this rule re-applied recursively for each time another list is found.\n\n<!-- <embed src=\"Images/list-to-tree.swf\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/\" width=\"500\" height=\"500\"></embed> -->\n\n<figure class=\"full-width\">\n\n![transforming a tree to a list](https://notionparallax.co.uk/assets/old/list to tree.svg)\n\n</figure>\n\nYou can read this diagram either way, as turning a list into a tree, or the other way around.\n",
 "content_html": "<h1>lists to trees</h1>\n<p>Gennaro asked me about data structures to contain a tree for his genetic programming in GC (little does he know how clueless I am about data structures), and I recommended a nested list.</p>\n\n<p>It seemed sensible to me, so I set about turning a nested list into a tree diagram, and I have to admit that there were moments that I doubted the plausibility of it, but it turned out OK in the end!</p>\n\n<p>The way to look at it seems to be that you work from the outside in. The outside set of brackets is the root, and then everything inside that is a terminal, with this rule re-applied recursively for each time another list is found.</p>\n\n<!-- <embed src=\"https://notionparallax.co.uk/2009/Images/list-to-tree.swf\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/\" width=\"500\" height=\"500\"></embed> -->\n\n<figure class=\"full-width\">\n\n  <p><img src=\"https://notionparallax.co.uk/assets/old/list%20to%20tree.svg\" alt=\"transforming a tree to a list\" /></p>\n\n</figure>\n\n<p>You can read this diagram either way, as turning a list into a tree, or the other way around.</p>\n",
 "content_hash": "sha256:98786dac61f989427f4f04e079238c8d91af4a481fa0b4ff9cbacdc50ca3af98",
 "media": [],
 "changelog": [
  {
   "version": 1,
   "at": "2009-03-01T15:08:22Z",
   "note": null
  }
 ],
 "transclusions": []
}