I’m thinking about some kind of immutable version of the following mutable object:
mutable struct MGlob
id::Int
children::Array{MGlob}
end
For example the immutable version, called struct Glob, would have the same id field but the children could be a Tuple of Globs now. If I use that approach, I guess I have two problems:
how to declare Glob, and
how to write the most efficient function to convert any MGlob to a Glob.
The conversion would change each MGlob object in the array of MGlobs to a Glob object in the tuple of Globs. For some reason I can’t get it. Thanks for any help!
That is good to know too. Right now I am interested in immutability for another reason also. Once I have constructed a big tree I would like to make sure I can’t inadvertently modify some part of it. (Well, maybe there are different ways to achieve the same goal which would be better!)
Thanks!