Clojure

pprint a GregorianCalendar results in Arity exception

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.8
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test
  • Approval:
    Ok

Description

What I was doing: attempting to pretty-print nested structures from Things mac app, which include instances of java.util.GregorianCalendar.
What I expected to happen: output should have an #inst very much like printing java.util.Date.
What happened instead: ArityException Wrong number of args (4) passed to: pprint$pretty-writer$fn

thingsplay.core=> (def nowish (java.util.GregorianCalendar.))
#'thingsplay.core/nowish
thingsplay.core=> nowish
#inst "2014-03-25T22:43:29.240-05:00"
thingsplay.core=> (use 'clojure.pprint)
nil
thingsplay.core=> (pprint nowish)
ArityException Wrong number of args (4) passed to: pprint$pretty-writer$fn  clojure.lang.AFn.throwArity (AFn.java:437)
#inst "
thingsplay.core=> (simple-dispatch nowish)
#inst "2014-03-25T22:43:29.240-05:00"nil
thingsplay.core=> nowish
#inst "2014-03-25T22:43:29.240-05:00"
thingsplay.core=> (write nowish)
ArityException Wrong number of args (4) passed to: pprint$pretty-writer$fn  clojure.lang.AFn.throwArity (AFn.java:437)
#inst "

Cause: clojure.pprint/pretty-writer does not fully implement the Writer interface used in printing the calendar.

Approach: Better implement Writer interface.

Patch: CLJ-1390-pprint-GregorianCalendar.patch

Screened by: Alex Miller

  1. 0001-CLJ-1390.patch
    29/Mar/14 4:18 PM
    0.9 kB
    Norman Richards
  2. 0002-CLJ-1390-test.patch
    04/Apr/14 8:30 PM
    0.9 kB
    Norman Richards
  3. 0002-CLJ-1390-test2.patch
    07/Apr/14 10:49 AM
    1 kB
    Norman Richards
  4. CLJ-1390-pprint-GregorianCalendar.patch
    10/Apr/14 4:38 PM
    2 kB
    Steve Miner

Activity

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: