Multiple-value-bind cancel the first value

In my code below I only want r.

(let* ((frac  (multiple-value-bind (f r)  (floor amt  100) r)))
..use frac..)

I get compilation warnings that indicate an unused variable f.

Is there an idiomatic way to write this?

+4
source share
2 answers

declare ignore usually useful in this context:

(multiple-value-bind (_ frac)  (floor amt 100)
  (declare (ignore _))
  ; use frac)
+6
source

NTH-VALUE allows you to select one of the return values ​​of the form. This will look like your fragment:

(let* ((frac (nth-value 1 (floor amt 100))))
  ...)
+6
source

Source: https://habr.com/ru/post/1538231/


All Articles