{"size": 1436, "ext": "scrbl", "max_stars_repo_path": "scribblings/ez-csv.scrbl", "max_stars_repo_name": "sleibrock/ez-csv", "max_stars_repo_stars_event_min_datetime": "2021-11-05T13:01:25.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-05T13:01:25.000Z", "max_issues_repo_path": "scribblings/ez-csv.scrbl", "max_issues_repo_name": "sleibrock/ez-csv", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "scribblings/ez-csv.scrbl", "max_forks_repo_name": "sleibrock/ez-csv", "max_forks_repo_forks_event_min_datetime": "2021-11-29T21:53:59.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T21:53:59.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 28.72, "max_line_length": 254, "alphanum_fraction": 0.7298050139}
#lang scribble/manual
@require[@for-label[ez-csv
                    racket/base]]

@title{ez-csv}
@author{Steven Leibrock}

@defmodule[ez-csv]

ez-csv is a Racket package dedicated to reading and writing CSV files. It works by reading lines of data from a CSV file, and if given the proper CSV values, will create a list of data from your CSV file that you can directly use in your Racket programs.

@code{ez-csv} works for both comma-delimited files and tab-delimited files, provided you make sure you indicate that when writing code.


@section{Installation}

Installation can be done via @code{raco}, which will then bring the ez-csv package into your Racket library. From there you use the standard require expression to import some of the bindings.

@racketblock[
(require ez-csv)
]


@section{Usage}

The usage of @code{ez-csv} is simple now with the new macro system in place. We use a call to @code{defrec} to generate bindings for our CSV records.

@racketblock[
; initialize and import the macro
(require ez-csv)

; create a new record
;(defrec Student ["Name" "StudentID"] [name id] ",")

; define some students
;(define my-students
;  (list
;   (Student "Frog" "12345")
;	(Student "Robo" "R-66Y")))

; write to a file
;(Students->csv "mykids.csv" my-students)

; or, read a file
;(define new-students (file->Students "new-year-students.csv"))

; print them out - each student is a hash
;(for-each displayln new-students)
]
