CSC448: Parsing: Coding Conventions [4/26] |
Immutable data structures simplify transformations.
Shallow vs. deep copy.
Linked lists and maps.
CAUTION: list.cons (x)
does not mutate list
!
list.cons (x); // INCORRECT: DISCARDS RESULT list2 = list.cons (x); // CORRECT: MAKES USE OF RESULT list = list.cons (x); // CORRECT: MAKES USE OF RESULT