Similar Items: A Categorical Model of State Transformations in Programming Languages