I\'m trying to implement a tree in F# using a list of tuples.
[a] where a = (string, [a])
Each node has a list of their childr
Try changing your data structure a bit:
type Tree =
| Branch of string * Tree list
| Leaf of string
let t2 = Branch ("a", [Branch ("b", [Leaf "c"; Leaf "d"]); Branch ("e", [Leaf "f"; Leaf "g"])])
let rec checkstuff tree =
match tree with
| Leaf _ -> true
| Branch (node, children) ->
List.fold ( || ) false (List.map checkstuff children)