3 ms·
Since (preamble) cannot possibly perform a side effect which affects the initializing expression 5, it can be moved: (if (cond) (let ((a 5)) (pream
by kazinator 3y ago
Since (preamble) cannot possibly perform a side effect which affects the initializing expression 5, it can be moved:
(if (cond)
(let ((a 5))
(preamble)
(do-stuff a))
(do-stuff 6))
You can work in side effects into the expressions of a let or let*:
(let* ((x (progn (widget-lock w)
(widget-x w)))
(y ...))
(...)
(widget-unlock w))
If lock-widget returns the widget, it can look like this:
(let* ((w (widget-lock w))
(x (widget-x x))
(y ...))
...
(widget-unlock w))