The key to this is that out
in this case is a continuation. Continuations, unlike procedures, do not return once invoked.
So, the two expressions in let
are executed sequentially: first, (lm (car l) out)
, then (lm (cdr l) out)
. Because out
is a continuation, and it's invoked when an atom is encountered, the (lm (car l) out)
will not return if an atom is encountered in the (car l)
. So the (lm (cdr l) out)
will only happen if there are no atoms in (car l)
---which is the case for your example of (() a)
.