How to create an unevaluated block for scratch expressions?

Hey guys!

I’m used to littering the code with copious amounts of top-level blocks, serving as evaluation history, like here:



Common Lisp:


I leave these behind most functions in my private projects as a permanent scratchpad, composing parts of the function, trying it out with different arguments, etc. I realize that this may not be the best practice for open projects, it’s just something I do for myself to iterate faster.

These blocks are ignored by the reader in both cases, and don’t impact the end product.

if false

This surprisingly only works if it’s the only such top-level block in the file. On the second one, it breaks with LoadError: syntax: incomplete: premature end of input, pointing to the if false line.

I’m looking for advice both for how to idiomatically approach something like this, and perhaps for creative workarounds! Thank you.

The blocks are just containers for the expressions within, I mostly send the expressions to repl one by one.

Might be because an if block requires to be closed with end (not endif)


Oh wow!

Well that was a mess. Thank you!

1 Like