Seems reasonable for the set and remove functions to return the replaced/removed value. The set function would be equivalent to a combination of remove and the existing insert, but I still think it's worth putting set as its own function.