random-state.net

Nikodemus Siivola

<< next | top | previous >>

Endless Loops and Interactive Development #
hacking, June 8th 2011

Tip of the day. Don't write:

(defun foo-loop (foo) (loop ...loop body...))

Instead, write:

(defun foo1 (foo) ...loop body...)
(defun foo-loop (foo) (loop (foo1 foo)))

It's a small thing, but it makes it much easier to debug the loop while it's running. If you need to instrument it, you can just add whatever code you need to FOO1 and recompile it.

If you open code almost anything inside the body of an endless loop, it becomes much harder to intercede — and interactive development is all about intercession with running code.