I'm trying to create a type like this:
type variable {
id: string;
tipe: int
}
type dec {
variables: variable list;
parent: dec option
}
During the execution of my program, I need to have a list of dec and add to runtime the variables, but with the list, I can't do that as it is an immutable data structure.
I'm trying to change the implementation and use a hash map to store the variable, for example, I need to store the variables as a hashtable with (key: string and value: int) but I have no idea how to implement a hash map with OCaml inside the type declaration.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…