Opened 3 years ago

Closed 3 years ago

#1786 closed defect (fixed)

tabular errors out when specifying both column-names and return-names

Reported by: Vasilij Schneidermann Owned by: Ivan Raikov
Priority: minor Milestone: someday
Component: extensions Version: 5.2.0
Keywords: tabular Cc:
Estimated difficulty:

Description

I'm trying out tabular as replacement for csv-abnf and found that it supports associating column names with rows. However if I specify both column-names (no matter whether it's set to the undocumented 'header option to automatically derive them from the first line or a list of strings to explicitly specify them) and return-names, I get an inscrutable backtrace:

(call-with-input-file "test.csv"
  (lambda (in)
    (let ((reader (csv:reader* in column-names: 'header return-names: #t)))
      (write (reader))
      (newline))))
Error: (map) bad argument type - not a proper list: ""

        Call history:

        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        <eval>    (write (reader))
        <eval>    (reader)
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?               <--

Change History (6)

comment:1 Changed 3 years ago by Ivan Raikov

Hi Vasilij, thanks for trying out tabular and for the bug report I have pushed a fix to the master branch of the tabular repository at https://github.com/iraikov/chicken-tabular. Could you try it out and let me know if it works for you?

comment:2 Changed 3 years ago by Vasilij Schneidermann

Hello Ivan, thank you for your quick response! With your fix I get a slightly different error:

Error: (map) bad argument type - not a proper list: "Field 1"

        Call history:

        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?         
        utf8-srfi-14.scm:101: iset#iset-contains?               <--

The test file:

Column 1,Column 2,Column 3
Field 1,Field 2,Field 3

comment:3 Changed 3 years ago by Ivan Raikov

Hi Vasilij,

Thanks, I have pushed a fix for the reader generator as well. Please try it out and let me know if there are remaining problem still.

comment:4 Changed 3 years ago by Vasilij Schneidermann

Thanks again! It now works correctly when using 'header, but not when explicitly specifying the column names:

(call-with-input-file "test.csv"
  (lambda (in)
    (let ((reader (csv:reader* in column-names: '("1" "2" "3") return-names: #t)))
      (write (reader))
      (newline))))
((("1" "2" "3") "Column 1") (#<procedure (a19935 . args)> "Column 2"))

comment:5 Changed 3 years ago by Ivan Raikov

Hi Vasilij,

Thanks again for uncovering more bugs. This was again a bug due to the difference between the interfaces of reader and reader*. I have again pushed the fix to the master branch, let me know about any other issues. Thanks a lot for your reports!

comment:6 Changed 3 years ago by Vasilij Schneidermann

Resolution: fixed
Status: assignedclosed

Thank you, now all cases work correctly.

Note: See TracTickets for help on using tickets.