我用CCL打电话给(load "code.lisp"),然后意外地删除了code.lisp。有什么方法可以让我检索源代码吗?CCL在任何地方都有记忆吗?
发布于 2015-04-08 07:51:03
这是一个非常特殊的功能。这里只提供Clozure CL。代码在其他任何地方都不起作用。这在CCL IDE中适用于我。它检索特定包中属于:internal或:external的符号的源代码。对于从其他包继承的符号,它不会这样做(然后,您通常会从包CL或CCL获得源代码,这有点过了)。
(defun retrieve-source-code (&optional (package *package*))
(do-symbols (s package)
(multiple-value-bind (symbol where)
(find-symbol (symbol-name s)
package)
(declare (ignore symbol))
(when (member where '(:internal :external))
(let ((ds (find-definition-sources s)))
(when (and ds (listp ds))
(loop for (nil sn) in ds
for snt = (source-note-text sn)
when snt do (progn
(terpri)
(princ snt)
(terpri)))))))))正如您所看到的,它可以检索自身(以及更多):
? (retrieve-source-code)
(defun retrieve-source-code (&optional (package *package*))
(do-symbols (s package)
(multiple-value-bind (symbol where)
(find-symbol (symbol-name s)
package)
(declare (ignore symbol))
(when (member where '(:internal :external))
(let ((ds (find-definition-sources s)))
(when (and ds (listp ds))
(loop for (nil sn) in ds
for snt = (source-note-text sn)
when snt do (progn
(terpri)
(princ snt)
(terpri)))))))))
NILhttps://stackoverflow.com/questions/29505734
复制相似问题