Suppose I get tired of writing "format t ..." all the time, and want something a little fewer keystrokes.
So I write this:
(defun puts (fstring &rest vars)
(format t fstring vars))
(puts "~a ~a" 1 2)
;; error message results, because vars became (1 2)
Now, vars
has been transformed into a list of whatever params I passed in. It needs to be "expanded" out into a list of values.
What is the typical solution to do this problem?
You can use apply
for that: (apply #'format t fstring vars)
expands vars
into separate arguments to format
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With