R Programming Assignment 2

caching using the lexical scoping