chickadee » csv-abnf » make-parser

make-parser #!optional DELIMITERprocedure

make-parser returns a constructor for the CSV parsing procedure. Optional argument DELIMITER specifies the field delimiter (comma by default). DELIMITER can be a character, or an SRFI-14 character set. The returned procedure takes in an input stream and returns a list of the form:

 ((<#csv-record (FIELD1 FIELD2 ...)>) (<#csv-record ... >))

where FIELD represents the field values in a record.

The following example illustrates the creation of an instance of <CSV> specialized for character lists.

(import abnf csv-abnf)

(define parse-csv (make-parser #\|))

(parse-csv (string->list "a|b|c"))

(map csv-record->list (parse-csv (string->list "a|b|c")))

 ==> (("a" "b" "c"))