Domanda di colloquio di Zendesk

Write a function memoize which takes a function and returns a new function which memoizes the result?