Summary

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

Metadata

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?               <--

Changes and comments

[2021-09-18 17:12:07 UTC] iraikov wrote:

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?

[2021-09-18 21:42:12 UTC] wasamasa wrote:

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

[2021-09-19 17:05:47 UTC] iraikov wrote:

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.

[2021-09-19 21:27:34 UTC] wasamasa wrote:

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

[2021-09-20 01:41:40 UTC] iraikov wrote:

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!

[2021-09-20 08:15:06 UTC] wasamasa changed status from assigned to closed

[2021-09-20 08:15:06 UTC] wasamasa set resolution to fixed

[2021-09-20 08:15:06 UTC] wasamasa wrote:

Thank you, now all cases work correctly.