开发者

Use the elements of the list in a format function

开发者 https://www.devze.com 2023-01-31 21:12 出处:网络
I want to do something like: (setf list \'(1 2 3 4 5 6)) (format t \"~A some text here ~A ~A ~A more text here ~A ~A\" list)

I want to do something like:

(setf list '(1 2 3 4 5 6))
(format t "~A some text here ~A ~A ~A more text here ~A ~A" list)

And have the开发者_如何学运维 output be

1 some text here 2 3 4 more text here 5 6

How can I do this without calling (nth 1 list) (nth 2 list) etc?


(format t "~{~A some text here ~A ~A ~A more text here ~A ~A~}" list)


Try

(apply #'format t "~A some text here ~A ~A ~A more text here ~A ~A" list)
0

精彩评论

暂无评论...
验证码 换一张
取 消