memoization of structure values