是否有内置函数来打印没有顶级括号的列表项,或者是否有更好的方法来编写
(defn println-list
"Prints a list without top-level parentheses, with a newline at the end"
[alist]
(doseq [item alist]
(print (str item " ")))
(print "\n"))
Run Code Online (Sandbox Code Playgroud)
得到的输出
user=> (println-list '(1 2 3 4))
1 2 3 4
nil
Run Code Online (Sandbox Code Playgroud)
Ger*_*ert 18
像这样的东西?
(apply println '(1 2 3 4 5))
1 2 3 4 5
nil
Run Code Online (Sandbox Code Playgroud)
Usage: (apply f args)
(apply f x args)
(apply f x y args)
(apply f x y z args)
(apply f a b c d & args)
Applies fn f to the argument list formed by prepending intervening
arguments to args.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3719 次 |
| 最近记录: |