LINUX.ORG.RU

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

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

Можно попробовать и без макр обойтись:

(defparameter *functions-cache*
  (make-hash-table :test 'equalp))

(defstruct expr oper op1 op2)

(defun build (info)
  (aif (gethash info *functions-cache*)
       it
       (setf (gethash info *functions-cache*)
               (lambda ()
                 (funcall (expr-oper info)
                          (expr-op1 info)
                          (expr-op2 info))))))

В любом случае, логика будет похожая.

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

Можно попробовать и без макр обойтись:

(defparameter *functions-cache*
  (make-hash-table :test 'equalp))

(defstruct expr oper op1 op2)

(defun build (info)
  (aif (gethash info *functions-cache*)
       it
       (setf (gethash info *functions-cache*)
               (lambda ()
                 (funcall (expr-oper info)
                          (expr-op1 info)
                          (expr-op2 info))))))