R code copied from Roger D. Peng's example for caching the mean of a vector
added description to existing instructions