The user-defined methods for the lazyvec are serialized along with the vector data. Upon deserialization, these methods will be available as list objects and called from the ALTREP API automatically. When these methods need helper functions, the user has to specify those separately, perhaps in a additional argument to lazyvec (as a list).