Add helpers for let handler

This commit is contained in:
Renaud Casenave-Péré 2015-03-25 23:25:25 +01:00
parent 1a94093619
commit f8c1db2192

View file

@ -27,6 +27,26 @@
"Retreive the handler for the symbol FIRST."
(gethash first *form-handlers* *default-handler*))
(defun binding-to-symbol (binding)
(let ((name (safe-first binding)))
(cond ((listp name)
(assert (eq 'setf (first name)))
(check-type (second name) symbol)
(second name))
(t
name))))
(defmacro with-imposed-bindings (&body body)
#-sbcl
`(locally ,@body)
#+sbcl
(destructuring-bind ((binder bindings &rest binder-body))
body
`(locally
(declare (sb-ext:disable-package-locks
,@(mapcar 'binding-to-symbol bindings)))
(,binder ,bindings ,@binder-body))))
(defun function-name-p (name)
"Return whether NAME is the name of a function."
(or (symbolp name)