stylewarning / quickutil

The solution to the Utility Library problem.
87 stars 8 forks source link

WITH-RETRY #65

Open j3pic opened 3 years ago

j3pic commented 3 years ago

;; Write the code here.

(defmacro with-retry (restart-name restart-description &body body)
  "Provides a restart named RESTART-NAME with RESTART-DESCRIPTION
as its English description in your debugger's restart menu. Invoking the
restart after an error in the BODY causes the BODY to be evaluated again."
  (let ((tag-name (gensym))
        (block-name (gensym)))
    `(block ,block-name
       (tagbody
          ,tag-name
          (restart-case
              (return-from ,block-name
                (progn ,@body))
            (,restart-name () :report ,restart-description
                           (go ,tag-name)))))))

Provides: WITH-RETRY Requires: nothing Author: j3pic License: BSD