str of an empty list is not "()"

Description

The str of an empty list is surprisingly not "()". This is inconsistent with the result for the empty map {} or empty vector (). It would be convenient if `(str ())` returned "()". The work-around is to use `pr-str`, which is arguably the "correct" thing to do. However, there doesn't seem to be any reason that Clojure couldn't return "()".

1 2 3 4 5 6 7 8 9 10 (str ()) ;=> "clojure.lang.PersistentList$EmptyList@1" (str {} [] ()) ;=> "{}[]clojure.lang.PersistentList$EmptyList@1" ;; Work-around: use `pr-str` instead of `str` (pr-str () {} []) "() {} []"

Patch: clj-1653-3.patch

Screened by: Alex Miller

Environment

None

Status

Assignee

Unassigned

Reporter

Steve Miner

Labels

Approval

Ok

Patch

Code and Test

Fix versions

Affects versions

Release 1.6

Priority

Minor
Configure