Is there an open source F # tree data structure?

I need a simple tree like this with all the fixes -

type 'a Tree = | Leaf of 'a | Branch of 'a Tree list 

There should be something like this already with a nice addition, deletion, display, filtering, dropping functions, etc., but I can not find it. I don’t even see one of OCaml that I can port ... I think I could write it myself if necessary.

EDIT: Changed tree structure will be more obvious.

+4
source share
1 answer

I think the difficulty is that a simple tree (with add Tree Tree answer) will not be used by anyone. Without specifying a more specific type of tree, you will have to implement all these methods by scanning, tank performance.

In addition, updating immutable trees is very expensive since a typical design has several common data structures.

Lastly, immutable trees must be completely rewritten each time if you allow any backtracking.

+1
source

All Articles