Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Completed
    • Affects versions: Release 1.6
    • Fix versions: Release 1.8
    • Labels:
    • Approval:
      Ok
    • Patch:
      Code and Test

      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 "()".

       
      (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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              steveminer@gmail.com Steve Miner
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: