I find data.tree cumbersome because of mutation. I want a library free of this inconvenience, but it does a lot of nice things I would miss. Convenient print methods, easy data.frame conversion, automatic ancestry/depth tracking. I am torn between writing lenses for data.tree and writing a simpler tree library built around a lens API. Provided I write simple conversions between the two we could potentially have the best of both worlds.
Writing lenses for data.tree would involve checking to see if the lens is pointing at a node, following the node's ancestry to the tree root, and triggering a full copy on set. It is possible I'm over-estimating the performance problems associated with this. R triggers full list copies on modify too, although I suspect R is making very smart choices about copying/GC that make it dramatically faster than copying data.trees (although I should really test).
Hacking a tree API seems easier to me than optimizing copy speed or decreasing copy frequency in data.tree but involves writing a lot more code.
Decisions, decisions.
I find
data.treecumbersome because of mutation. I want a library free of this inconvenience, but it does a lot of nice things I would miss. Convenient print methods, easydata.frameconversion, automatic ancestry/depth tracking. I am torn between writing lenses fordata.treeand writing a simpler tree library built around a lens API. Provided I write simple conversions between the two we could potentially have the best of both worlds.Writing lenses for
data.treewould involve checking to see if the lens is pointing at a node, following the node's ancestry to the tree root, and triggering a full copy onset. It is possible I'm over-estimating the performance problems associated with this. R triggers full list copies on modify too, although I suspect R is making very smart choices about copying/GC that make it dramatically faster than copyingdata.trees (although I should really test).Hacking a tree API seems easier to me than optimizing copy speed or decreasing copy frequency in
data.treebut involves writing a lot more code.Decisions, decisions.