HW 5: made the Location class immutable; used partial_functions