printing - 你如何在 lisp 的同一行上打印两个项目?

标签 printing format lisp common-lisp

我正在寻找类似的东西:

(printem 1 2)
1 2

我假设您使用格式调用来执行此操作,但示例并不关注此。或者也许你写一个字符串并输出它?但这似乎也不对。

最佳答案

您可以简单地构建一个函数,通过 iteration construct 打印其所有参数的格式。

(defun printem (&rest args)
  (format t "~{~a~^ ~}" args))

用法:

CL-USER> (printem 1 2 3)
1 2 3
CL-USER> (printem '(1 2 3) '(4 5 6))
(1 2 3) (4 5 6)

关于printing - 你如何在 lisp 的同一行上打印两个项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35187392/

相关文章:

c - 如何使用 ncurses 同时打印两件事

java - 如何获取打印机的位置

c - 如何用 C 语言从文本文件中读取并打印随机单词

PHP 使用单个 fscanf 从多行读取?

string - 戈朗 : print string array in an unique way

c# - 无需外部工具即可打印 PDF

python - Django Wagtail - 如何设置日期格式?

lisp - 从终端命令提示符运行 Common Lisp 函数

clojure - Lisp-1 和 Lisp-2 有什么区别?

lisp - 使用方案/ Racket 从列表中返回特定项目