Skip to content

j3pic/recursive-restart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

recursive-restart

Implements several forms for using restarts recursively. The first is recursive-restart-case, which works exactly like CL's native restart-case, except you can invoke the restarts from the restart handlers in a mutually-recursive fashion, such as this:

(let ((invoked-bar nil))
  (recursive-restart-case
       (invoke-restart 'foo)
    (foo ()
       (format t "Invoked FOO.~%")
       (if invoked-bar
           :done
           (invoke-restart 'bar)))
    (bar ()
       (format t "Invoked BAR.~%")
       (setf invoked-bar t)
       (format t "Invoking FOO again...~%")
       (invoke-restart 'foo))))

Also provided is restart-labels, which is a wrapper macro that allows you to specify the handlers before the body, which gains an implicit PROGN. The syntax mirrors that of CL's labels form:

(restart-labels
   ((foo () (format t "Invoked FOO.~%"))
    (bar () (format t "Invoked BAR.~%")))
  (format t "Starting body...~%")
  (invoke-restart 'foo))

restart-bind* is to restart-labels as let* is to let, ie, each handler is wrapped in a new recursive-restart-case.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published