What is the difference between an array and a slice in Go?
Asked in the Golang deep-dive interview stage. Implement a simulator that exposes the difference through mutation and append behavior.
model_go_array_slice(initial, operations) receives an integer list and operations. The initial slice has length and capacity equal to len(initial), and initially shares storage with the array. Return one snapshot for every snapshot operation, each containing the current array and slice lists.
Operations are dictionaries: {"op": "set_array"|"set_slice", "index": i, "value": v}, {"op": "append", "value": v}, or {"op": "snapshot"}.
def model_go_array_slice(initial, operations):