LINUX.ORG.RU

История изменений

Исправление monk, (текущая версия) :

(defun mkstr (&rest args)
 (with-output-to-string (s)
   (dolist (x args) (princ x s))))

(let ((cache (make-hash-table)))
 (defmacro make-fun ((&rest args) &rest body)
  (let ((name (intern (mkstr (list args body)))))
   (or (gethash name cache)
       (setf (gethash name cache)
	     (eval `(compile nil (lambda ,args ,@body))))))))

(defun xx ()
 (eq (make-fun (x) 1) (make-fun (x) 1)))
* (compile-file "test2")

...
; caught ERROR:
;   Objects of type FUNCTION can't be dumped into fasl files.
...

Исправление monk, :

(defun mkstr (&rest args)
 (with-output-to-string (s)
   (dolist (x args) (princ x s))))

(let ((cache (make-hash-table)))
 (defmacro make-fun ((&rest args) &rest body)
  (let ((name (intern (mkstr (list args body)))))
   (or (gethash name cache)
       (setf (gethash name cache)
	     (eval `(compile nil (lambda ,args ,@body))))))))
* (compile-file "test2")

...
; caught ERROR:
;   Objects of type FUNCTION can't be dumped into fasl files.
...

Исходная версия monk, :

* (compile-file "test2")

...
; caught ERROR:
;   Objects of type FUNCTION can't be dumped into fasl files.
...