Consider the code below:
a = 42 b = "Julia confuses me" namedTuple =(; a, b) println(namedTuple) println(ismutable(namedTuple)) # gives false c = pi/2 namedTuple = (;namedTuple..., c) # Why is this permitted... println(namedTuple) println(ismutable(namedTuple)) # gives false namedTuple.c = exp(1) # ... While this gives ERROR: LoadError: setfield!: immutable struct of type NamedTuple cannot be changed
In particular I do not get why I can change
namedTuple through addition of a new element, but cannot change existing.
Additionally, how do I make