multiple-value-bind丢弃第一个值

RAb*_*ham 6 common-lisp

在下面的代码中,我只想要r.

(let* ((frac  (multiple-value-bind (f r)  (floor amt  100) r)))
..use frac..)
Run Code Online (Sandbox Code Playgroud)

我收到编译警告说未使用的变量f.

有没有惯用的写作方式?

use*_*lpa 9

declare ignore 在这种情况下通常很有用,这里:

(multiple-value-bind (_ frac)  (floor amt 100)
  (declare (ignore _))
  ; use frac)
Run Code Online (Sandbox Code Playgroud)


m-n*_*m-n 7

NTH-VALUE允许您选择表单的返回值之一.这将表现得像您的代码段:

(let* ((frac (nth-value 1 (floor amt 100))))
  ...)
Run Code Online (Sandbox Code Playgroud)