Clojure

ArrayMaps print-dup with read-eval

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Declined
  • Affects Version/s: Release 1.3
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test

Description

user=> (binding [*print-dup* true] (print-str (hash-map :k :v)))
"{:k :v}"
user=> (binding [*print-dup* true] (print-str {:k :v}))
"#=(clojure.lang.PersistentArrayMap/create {:k :v})"

In the top example, the reader will automatically create an array-map due to the number of entries, so unless there is an overriding reason to force type-preservation in the bottom example, it can likewise be printed as a literal map.

Activity

Hide
Alexander Taggart added a comment -

Apply patch after CLJ-797.

Show
Alexander Taggart added a comment - Apply patch after CLJ-797.
Hide
Rich Hickey added a comment -

The point of print-dup is type preservation

Show
Rich Hickey added a comment - The point of print-dup is type preservation

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: