The original Structure.
(define x #{a: "The " b: "Rain " c: "in " d: "Spain "})
|
Returns: #<Structure 123456>
|
The copied Structure using the copy function.
(setq clone (copy x)) |
Returns: #<Structure 234567>
|
The copied Structure using the setq function.
(setq z x) |
Returns: #<Structure 345678>
|
The contents of x, clone and z Structures respectively.
(display x) |
Returns: #{a: "The " b: "Rain " c: "in " d: "Spain "}
|
(display clone) |
Returns: #{a: "The " b: "Rain " c: "in " d: "Spain "}
|
(display z) |
Returns: #{a: "The " b: "Rain " c: "in " d: "Spain "}
|
The second element of the original Structure is modified.
(setq x[1] "Hail" ) |
Returns: #<Structure 123456>
|
The original Structure contains the modified value.
(display x) |
Returns: #{a: "The " b: "Rain " c: "in " d: "Spain "}
|
The copied Structure using the copy function does not contain the modified
value since the copied Structure produced is stored in a different memory location.
(display clone) |
Returns: #{a: "The " b: "Hail " c: "in " d: "Spain "}
|
The copied structure using the setq function contains the modified value
since both x and z Structures are pointing to the same data.
(display z) |
Returns: #{a: "The " b: "Rain " c: "in " d: "Spain "}
|