cut_hair = function p -> r p.hairlength /= 2; endsince the function cut_hair will duplicate the argument passed to it and only change the hair_length of the duplicate. If we do want to alter the status of a class member, we can pass a pointer to the class member to the function.
cut_hair = function p -> r p >>. hairlength /= 2; end p = person.new(); cut_hair(>>p);