
17 Aug
2010
17 Aug
'10
2:26 p.m.
On Tuesday 17 August 2010 16:08:49, C Gosch wrote:
Since the graph is immutable most of the nodes in the new graph are shared with nodes in the old graph. This is know as path copying and is everywhere persistent ("immutable") data structures are used. Updating a data structure (e.g. a tree) typically requires O(log n) nodes to be copied.
So that means the compiler figures this out for my own data structures, or do I have to take care that copying is done this way? Sorry for my ignorance, I'm still learning :)
It's done automatically (and, if your nodes contain huge data, you'll be happy to learn tha the data isn't copied at all, only the pointers to it).