4 ms·
(defun for-duration (seconds body) (handler-case (bt:with-timeout seconds (body)) (bt:timeout () nil)))
by GregBuchholz 16y ago
(defun for-duration (seconds body)
(handler-case
(bt:with-timeout seconds
(body))
(bt:timeout () nil)))
(for-duration 10
(lambda ()
(loop
(print "Infinite loop! where is your Godel now?"))))
- makmanalp 16y agoI think Greg is trying to say "why the hell do we even need macros for this"?
- mahmud 16y agoWith functions you have to make a conscious effort to quote arguments, otherwise the strict evaluation will evaluate its arguments before the function. Also, with macros you can introduce you new "implicit" control and structure semantics; it's very common for forms to have an "implicit progn", or a block named NIL or similar.