Welcome! Please see the About page for a little more info on how this works.

0 votes
in Printing by

In Common Lisp, (format nil "~a" :A) returns "A". However, in Clojure, it returns with the colon:

(clojure.pprint/cl-format false "~a" :A) => ":A"

5 Answers

0 votes
by

Comment made by: jongwon.choi

Found another problem of cl-format:

(clojure.pprint/cl-format false "SELECT from RateSchedules ~@(link: WHERE ~{~A=?~^ ~}~)" '())
=> "SELECT
from RateSchedules WHERE" ;; instead of "SELECT * from RateSchedules"

I guess the problem is () or (link: ) has to be treated as falsey but not.

0 votes
by

Comment made by: alexmiller

:a is a keyword and I would expect it's ascii format to be :a. I'm not sure what case sensitivity has to do with it.

0 votes
by

Comment made by: jafingerhut

Alex, case is a side issue. Common Lisp's (format nil "~a" :A) returns "A", not ":A". It is the presence of the colon in the output that is the issue, not the case of the string.

0 votes
by

Comment made by: jongwon.choi

For a record, what Alex described is for ~S - standard. See http://www.lispworks.com/documentation/lw50/CLHS/Body/22_cd.htm

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1818 (reported by alex+import)
...