3

我已按以下方式设置调度表:

(setq hunchentoot:*dispatch-table*
        (mapcar #'(lambda (regex-and-handler)
                    (hunchentoot:create-regex-dispatcher (first regex-and-handler)
                                                         (second regex-and-handler)))
                (list (list "^/one$" #'page-one)
                      (list "^/two$" #'page-two))))

现在,如果我重新定义 function page-one,仍然使用旧定义,并且仅在重新评估表单*dispatch-table*时才使用新定义。(setq ...)有没有办法让它接受新的函数定义?

4

1 回答 1

4

在评估列表时,使用函数的名称作为符号,而不是使用function(reader syntax ) 将符号解析为函数对象。#'换句话说:

....
(list (list "^/one$" 'page-one)
      (list "^/two$" 'page-two))))
于 2019-09-18T12:14:27.490 回答