Say I have a list of arguments:
> (setf format-args `(t "it's ~a" 1))
(T "it's ~a" 1)
How can I then "splat" or "unroll" this into a series of arguments rather than a single list argument, for supplying to the format function? i.e I would like the following function call to take place:
> (format t "it's ~a" 1)
For reference, I would write the following in python or ruby:
format(*format-args)
I'm sure it can be done, but perhaps I'm thinking about it wrong. It also doesn't help that the name for this operation doesn't seem to be terribly well agreed upon...
Oops! I should have remembered how javascript does it.
Turns out you use the apply function, as in:
(apply #'format format-args)
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