I am practicing purely functional style in C++. One big question is how can I construct tree data structure efficiently. Especially the back-edges. The connection to super-node. This can be thought as how to make a reference.
In C++, people simply use pointer (or smart pointer) for the back-edges, but AFAIK, purely functional (or referential transparency) means it's completely value based, so pointer or reference doesn't mean anything anymore.
I know this can be solved using huge vertex/edge table approach, but it seems to be very inefficient because it essentially needs lookup for every operation.
Any suggestions?
My question is not limited to C++. If you know another way to do this in another languages, please let me know.