> I'm used to sprinkling print statements in my code as a way of tracking
> down bugs but they seem to be affecting my code more than I was expecting.
I recommend to look at 'trace' and 'msg'. They both output to stderr and don't
interfer with the expressions.
'trace' shows what argumments are passed, and what the functions return. See the
tutorial for examples.
'msg' prints its argument to stderr *and* returns it, so it does not destroy the
flow. For example:
Now this would be wrong:
But this is all right:
(if (msg (condition) " condition")
(msg (doTrue) " true")
(msm (doFalse1) " false")
Even easier is not to modify the source at all, and do instead, before starting
(mapc trace '(condition doTrue doFalse1))
And/or use 'debug' to single-trace your program. Again see the tutorial.
> I've also realised I'm never quite sure when and when I shouldn't precede a
> symbol with a quote e.g. as a function argument in a (debug 'Symbol)
> statement and wonder if there are some very simple rules of thumb.
It is noted in the reference. If an argument is noted as eg. 'any it means that
the argument is *evaluated* (not necessarily that you actually need to write a