Earlier quoted context omitted.
Step1: Write a test. Step2, IDE: Right click + Run. Step2, CLI: $ run Bonus: The test is now part of your automated test suite, and will be ran many times to ensure things don't break.
What if you don't know what you want it to do yet? Maybe you have a new API or library you're working with and the documentation is lacking. Maybe you're exploring some dataset trying to figure out what kind of information can be gleaned from it. Maybe it takes 3 minutes to get it into the state where it failed, so instead of starting over every change you just want to modify the one function over and over. Doing it…
B. Then memoize the expensive function to disk. Bonus: Can keep multiple versions on disk, thus can tweak the expensive function while having fast reloads with guaranteed correct version.