我从sbcl编译器收到一个警告,一个变量已被定义但未被使用.编译器是对的.我想摆脱警告,但不知道该怎么做.这是一个例子:
(defun worker-1 (context p)
;; check context (make use of context argument)
(if context
(print p)))
(defun worker-2 (context p)
;; don't care about context
;; will throw a warning about unused argument
(print p))
;;
;; calls a given worker with context and p
;; doesn't know which arguments will be used by the
;; implementation of the called worker
(defun do-cmd (workerFn context p)
(funcall workerFn context p))
(defun main ()
(let ((context ()))
(do-cmd #'worker-1 context …Run Code Online (Sandbox Code Playgroud) 使用SBCL时,我遇到的问题是,当lisp代码定义一个字符串常量时,通过ASDF定义的系统不会加载.这是代码:
constants.lisp
(defconstant A 1.0)
(defconstant B "B")
Run Code Online (Sandbox Code Playgroud)
simple.asd
(defsystem :simple
:components ((:file "constants")))
Run Code Online (Sandbox Code Playgroud)
在加载时
(asdf:load-system "simple")
Run Code Online (Sandbox Code Playgroud)
我收到以下错误(输出已经缩短了一点):
* (asdf:load-system "simple")
; compiling file "/Users/.../constants.lisp"
; compiling (DEFCONSTANT A ...)
; compiling (DEFCONSTANT B ...)
; /Users/.../constants-TMP.fasl written
; compilation finished in 0:00:00.003
debugger invoked on a DEFCONSTANT-UNEQL in thread
#<THREAD "main thread" RUNNING {1002BFEA93}>:
The constant B is being redefined (from "B" to "B")
Run Code Online (Sandbox Code Playgroud)
clisp,ccl和abcl没有出现错误.另外,通过加载文件
(load "constants.lisp")
Run Code Online (Sandbox Code Playgroud)
工作良好.
我正在使用
SBCL 1.2.14,ASDF 3.1.3,MacOS
谢谢你的任何提示,
奥利弗