Source of Nothingness - xyzzy lisp : format ~{

* xyzzy lisp : format ~{

(format nil "~{~A ~}" '(a b c d))
"a b c d "
(format nil "~:{~A ~}" '((a) (b) (c) (d)))
"a b c d "
(format nil "~@{~A ~}" 'a 'b 'c 'd)
"a b c d "
(format nil "~:@{~A ~}" '(a) '(b) '(c) '(d))
"a b c d "
(format nil "~2{~A ~}" '(a b c d))
"a b "
(format nil "~{~A ~}" nil)
""
(format nil "~{~A ~:}" '(a))    ; nilが引数だとエラー
"a "
; "~^"と一緒に使うのが便利
(format nil "~{~A~^,  ~}~%" '(one two three four)) ; 最後に", "はいらない
"one,  two,  three,  four
"

update : 2006-10-04 (Wed) 00:15:53