Question d’entretien chez Zendesk

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