Memoization support for user defined functions