Scala macro-based utility for function memoization