Clojure

clojure.inspector/inspect-table gives up when first element of coll is nil

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Trivial Trivial
  • Resolution: Unresolved
  • Affects Version/s: Release 1.4
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Ubuntu 12.04, Java 7, Clojure 1.4
  • Patch:
    Code

Description

clojure.inspector/inspect-table gives up when first element of coll is nil. The patch provided is rather trivial...instead of blindly choosing the first element (which might be nil), it would be more convenient to choose the first element that is NOT nil and use its keys for columns...a similar issue exists with clojure.pprint/print-table where the keys of the first element are used (if not provided explicitly). The same is not true for 'inspect-table' though. As a result, one cannot 'inspect' a collection of maps where the first element is nil. My (trivial) patch looks for the first element which is NOT nil and uses its keys instead. Maps have to have the same length anyway so no problems there...

  1. clj-1020-inspect-table-skip-nil-rows-patch1.txt
    12/Jul/12 1:01 PM
    0.7 kB
    Andy Fingerhut
  2. clj-1020-inspect-table-skip-nil-rows-patch2.txt
    02/Aug/13 9:17 AM
    0.7 kB
    Dimitrios Piliouras
  3. inspector.patch
    02/Jul/12 5:26 AM
    0.3 kB
    Dimitrios Piliouras

Activity

Hide
Andy Fingerhut added a comment -

clj-1020-inspect-table-skip-nil-rows-patch1.txt of July 12, 2012 is identical to inspector.patch of July 2, 2012, except it is in the desired git format. Proper attribution is given to author Dimitrios Piliouras in the patch.

Show
Andy Fingerhut added a comment - clj-1020-inspect-table-skip-nil-rows-patch1.txt of July 12, 2012 is identical to inspector.patch of July 2, 2012, except it is in the desired git format. Proper attribution is given to author Dimitrios Piliouras in the patch.
Andy Fingerhut made changes -
Field Original Value New Value
Attachment clj-1020-inspect-table-skip-nil-rows-patch1.txt [ 11379 ]
Andy Fingerhut made changes -
Patch Fixed [ 10009 ] Code [ 10001 ]
Hide
Dimitrios Piliouras added a comment -

I literally copied the contents of "clj-1020-inspect-table-skip-nil-rows-patch1.txt" and pasted them on "clj-1020-inspect-table-skip-nil-rows-patch2.txt" only changing:

(some #(when-not (nil? %) %) data)
to
(some identity data)

much nicer/cleaner and faster since we skip the internal nil-test.

Show
Dimitrios Piliouras added a comment - I literally copied the contents of "clj-1020-inspect-table-skip-nil-rows-patch1.txt" and pasted them on "clj-1020-inspect-table-skip-nil-rows-patch2.txt" only changing: (some #(when-not (nil? %) %) data) to (some identity data) much nicer/cleaner and faster since we skip the internal nil-test.
Dimitrios Piliouras made changes -
Alex Miller made changes -
Labels patch,

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: