- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
在 sbcl 中,我知道在 defun 中同时使用 &optional 和 &key 时我可以消除预期的消息,但这在 defmacro 中似乎不起作用。 (我应该重新设计/重写,我知道,但这是遗留代码。)
当我编译这个文件时...
(declaim (sb-ext:muffle-conditions style-warning))
(defun wilma (&optional wilma1 &key wilma2 wilma3)
(declare (ignore wilma1 wilma2 wilma3)))
(defmacro betty (&optional betty1 &key betty2 betty3)
(declare (ignore betty1 betty2 betty3)))
...这发生了:
home:~/sbcl/experiments/style-warning.d$ sbcl --noinform
* (compile-file "5.lisp")
; compiling file "/u/home/sbcl/experiments/style-warning.d/5.lisp" (written 09 OCT 2017 03:31:44 PM):
; compiling (DECLAIM (MUFFLE-CONDITIONS STYLE-WARNING))
; compiling (DEFUN WILMA ...)
; compiling (DEFMACRO BETTY ...)
; file: /u/home/sbcl/experiments/style-warning.d/5.lisp
; in: DEFMACRO BETTY
; (DEFMACRO BETTY (&OPTIONAL BETTY1 &KEY BETTY2 BETTY3)
; (DECLARE (IGNORE BETTY1 BETTY2 BETTY3)))
;
; caught STYLE-WARNING:
; &OPTIONAL and &KEY found in the same lambda list: (&OPTIONAL BETTY1 &KEY BETTY2
; BETTY3)
;
; compilation unit finished
; caught 1 STYLE-WARNING condition
; /u/home/sbcl/experiments/style-warning.d/5.fasl written
; compilation finished in 0:00:00.018
#P"/u/home/sbcl/experiments/style-warning.d/5.fasl"
T
NIL
* (exit)
home:~/sbcl/experiments/style-warning.d$
如何抑制这些诊断?
编辑 1:
因为这是遗留代码,我只是为了 sbcl-readiness 对它进行修改,然后不管它,所以我没有理由不能在使用它的任何代码中做这样的事情:
home:~/sbcl/experiments/style-warning.d$ sbcl --noinform
* (with-open-file (*error-output* "/dev/null" :direction :output :if-exists :append)
(compile-file "5.lisp"))
; compiling file "/u/home/sbcl/experiments/style-warning.d/5.lisp" (written 09 OCT 2017 03:31:44 PM):
; compiling (DECLAIM (MUFFLE-CONDITIONS STYLE-WARNING))
; compiling (DEFUN WILMA ...)
; compiling (DEFMACRO BETTY ...)
; /u/home/sbcl/experiments/style-warning.d/5.fasl written
; compilation finished in 0:00:00.017
#P"/u/home/sbcl/experiments/style-warning.d/5.fasl"
T
NIL
* (exit)
home:~/sbcl/experiments/style-warning.d$
但是有什么东西可以抑制宏定义中的样式警告吗?
最佳答案
你需要运行
(declaim (sb-ext:muffle-conditions style-warning))
在形式(defmacro betty ...)
被编译之前。
一种方法是
$ sbcl --non-interactive --eval '(declaim (sb-ext:muffle-conditions style-warning))' --eval '(compile-file "5")'
This is SBCL 1.4.0, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
; compiling file "/Users/sds/lisp/5.lisp" (written 09 OCT 2017 09:51:51 PM):
; compiling (DEFUN WILMA ...)
; compiling (DEFMACRO BETTY ...)
; /Users/sds/lisp/5.fasl written
; compilation finished in 0:00:00.010
文件 5.lisp
只包含 wilma
和 betty
:
(defun wilma (&optional wilma1 &key wilma2 wilma3)
(declare (ignore wilma1 wilma2 wilma3)))
(defmacro betty (&optional betty1 &key betty2 betty3)
(declare (ignore betty1 betty2 betty3)))
关于lisp - sbcl:defmacro 中的马弗风格警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46656090/
在 SBCL 上编译 ACL2 时如何避免低级调试器崩溃?这是我在 Linux 上使用 SBCL 1.2.3 编译时收到的错误消息: ACL2 loading '((COMP-FN :EXEC NI
我一直在尝试为 CFFI 绑定(bind) (https://gitorious.org/dh-misc/hdf5/source/cb616fd619a387e3cdc927994b9ad12b6b5
我正在使用 SBCL 转储用 CL 编写的新解释器,并且需要确定二进制文件(可执行 sbcl 转储)的位置以设置一些搜索路径。有没有办法找出方法?我试过 *core-pathname* 但它似乎没有在
我是 lisp 编程的新手。我正在使用 sbcl。在程序线程的一部分中创建为- (sb-thread:make-thread (lambda () (progn (sleep
sbcl 中位向量使用多少内存? 每一位是否花费 1 位内存? 每个位是否花费 1 个字节的内存? 每比特花费 1 个字的内存吗? 最佳答案 SBCL 中的位向量以每位一位有效存储,加上每个向量的一些
我需要分析一个“慢”的函数,即需要非常很长时间才能终止(如果有的话)。在我看来,仍然可以使用 SBCL 中的统计分析器来分析此函数,因为它只是定期采样。然而,当我运行时 (sb-sprof:with-
亲爱的 StackExchange 成员(member), 我最近开始研究 Common Lisp 并想创建一个 Web 界面来管理一个模组化的 Minecraft 服务器。我已经试过了 this s
我正在使用 SBCL 的统计分析器来分析这些函数: (defun fact-rec (n) (if (zerop n) 1 (* n (fact-rec (1- n))))
我想使用 bashcript 将一个字符串作为单个参数传递给 sbcl,但 sbcl 将该字符串拆分为一个列表。 脚本 #!/bin/bash sbcl --noinform --eval "
如何为所有功能设置优化选项,如“speed 3”? (declaim (optimize (speed 3) (debug 0) (safety 0)) 没用( 最佳答案 %> cat test.li
在 sbcl 中, *(sb-mop:class-precedence-list (find-class 'cons)) ==>(# # # #) cons 继承自 list 而不是相反,这不是很奇
我想使用适用于 Windows x86_64 的 SBCL 1.3.3 在 Lisp 中编写斐波那契数计算函数 fib。使用惰性计算来避免重复。到目前为止的工作代码是: (defvar *fibs*
首先,我被迫使用 LispWorks,我想知道它实际使用的是什么编译器,以及我是否可以在 CLI 中使用它。同样在 LispWorks 中,有 defsystem 等方法,它们是以某种方式构建在环境中
如何在开始时禁用包锁定? 我试图将 (sb-ext:disable-package-locks sb-alien) 放在 .sbclrc, 但是,它似乎不起作用。 最佳答案 sb-ext:disabl
考虑这个简单的例子: (deftype image nil '(simple-array single-float (100))) 这里我们定义了一个类型的简写,它是一个包含单个 float 的数组。
众所周知,Maxima 基于普通的 lisp。我正在编写一个在 Maxima 中工作的 lisp 程序;使用 Maxima 程序。我按下参数“maxima -p foo.lisp”来加载 lisp 文
我正在尝试为 SBCL 中实现的订单统计函数计时.谷歌搜索我发现了这个计时功能:(时间形式)。但是我不确定它会返回什么。这似乎是一个很大的数字,但我找不到指定返回值是毫秒、纳秒、系统时间等的文档。 有
我编写了一个服务器,用于生成新线程。其中一些线程需要写入标准输出,但当它们写入时,终端中不会显示任何内容。 sbcl 中是否有某种类型的消息传递 api 允许我将消息发送回主线程? 非常感谢! 最佳答
我试图弄清楚如何在使用 break 之类的东西调用调试器后单步执行 sbcl 和 Slime 中的代码。我不想从头开始。例如,如果我有以下代码: (defun fib (n) (when (eql
函数: 给定一个列表 lst 返回列表内容的所有排列恰好长度为 k,如果没有提供则默认为列表的长度。 (defun permute (lst &optional (k (length lst)))
我是一名优秀的程序员,十分优秀!