- bi-csv DELIMITERprocedure
A whole CSV file: a list of rows, each followed by a line ending. Its printer accepts a list whose elements are each either a csv-record or a raw list of field values.
(import csv-abnf abnf-lens) ;; bp-parse returns (list (list matched-value) remaining-stream); ;; (car (car ...)) unwraps it to the list of csv-records. (car (car (bp-parse (bi-csv #\,) "a,b\r\nc,d\r\n" (lambda (s) (error "parse failed" s))))) ;; => (list (list->csv-record '("a" "b")) (list->csv-record '("c" "d"))) (bp-print (bi-csv #\,) '(("a" "b") ("c" "d"))) ;; => "a,b\r\nc,d\r\n"