【问题标题】:Use the elements of the list in a format function在格式化函数中使用列表的元素
【发布时间】:2010-12-19 19:01:47
【问题描述】:

我想做这样的事情:

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

然后输出是

1 这里有一些文字 2 3 4 这里有更多文字 5 6

如何在不调用 (nth 1 list) (nth 2 list) 等的情况下执行此操作?

【问题讨论】:

    标签: lisp common-lisp clisp


    【解决方案1】:
    (format t "~{~A some text here ~A ~A ~A more text here ~A ~A~}" list)
    

    【讨论】:

      【解决方案2】:

      试试

      (应用 #'format t "~A some text here ~A ~A ~A more text here ~A ~A" 列表)

      【讨论】:

        猜你喜欢
        • 2015-07-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-12-18
        • 2012-01-11
        • 1970-01-01
        • 2017-02-07
        相关资源
        最近更新 更多