Discrete dynamic programming for macroeconomists