Utility decorator to checkpoint intermediate results in a computation.