| 
									
										
										
										
											2009-01-30 20:23:04 -05:00
										 |  |  | USING: help.syntax help.markup kernel prettyprint sequences | 
					
						
							|  |  |  | io.pathnames ;
 | 
					
						
							| 
									
										
										
										
											2008-04-17 16:29:04 -04:00
										 |  |  | IN: csv | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | HELP: csv | 
					
						
							| 
									
										
										
										
											2008-07-25 17:02:07 -04:00
										 |  |  | { $values { "stream" "an input stream" } | 
					
						
							| 
									
										
										
										
											2008-04-17 16:29:04 -04:00
										 |  |  |           { "rows" "an array of arrays of fields" } }  | 
					
						
							| 
									
										
										
										
											2009-01-30 20:23:04 -05:00
										 |  |  | { $description "Parses a csv stream into an array of row arrays." } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | HELP: file>csv | 
					
						
							|  |  |  | { $values | 
					
						
							|  |  |  |     { "path" pathname } { "encoding" "an encoding descriptor" } | 
					
						
							|  |  |  |     { "csv" "csv" } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | { $description "Opens a file and parses it into a sequence of comma-separated-value fields." } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | HELP: csv>file | 
					
						
							|  |  |  | { $values | 
					
						
							|  |  |  |     { "rows" "a sequence of sequences of strings" } | 
					
						
							|  |  |  |     { "path" pathname } { "encoding" "an encoding descriptor" } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | { $description "Writes a comma-separated-value structure to a file." } ;
 | 
					
						
							| 
									
										
										
										
											2008-04-17 16:29:04 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | HELP: csv-row | 
					
						
							| 
									
										
										
										
											2008-07-25 17:02:07 -04:00
										 |  |  | { $values { "stream" "an input stream" } | 
					
						
							| 
									
										
										
										
											2008-04-17 16:29:04 -04:00
										 |  |  |           { "row" "an array of fields" } }  | 
					
						
							| 
									
										
										
										
											2009-01-30 20:23:04 -05:00
										 |  |  | { $description "parses a row from a csv stream" } ;
 | 
					
						
							| 
									
										
										
										
											2008-04-30 12:50:40 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-25 17:02:07 -04:00
										 |  |  | HELP: write-csv | 
					
						
							| 
									
										
										
										
											2009-01-30 20:23:04 -05:00
										 |  |  | { $values { "rows" "a sequence of sequences of strings" } | 
					
						
							| 
									
										
										
										
											2008-07-25 17:02:07 -04:00
										 |  |  |           { "stream" "an output stream" } }  | 
					
						
							| 
									
										
										
										
											2009-01-30 20:23:04 -05:00
										 |  |  | { $description "Writes a sequence of sequences of comma-separated-values to the output stream, escaping where necessary." } ;
 | 
					
						
							| 
									
										
										
										
											2008-04-30 12:50:40 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | HELP: with-delimiter | 
					
						
							| 
									
										
										
										
											2009-01-30 20:23:04 -05:00
										 |  |  | { $values { "ch" "field delimiter (e.g. CHAR: \t)" } | 
					
						
							| 
									
										
										
										
											2008-04-30 12:50:40 -04:00
										 |  |  |           { "quot" "a quotation" } } | 
					
						
							| 
									
										
										
										
											2009-01-30 20:23:04 -05:00
										 |  |  | { $description "Sets the field delimiter for csv or csv-row words." } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ARTICLE: "csv" "Comma-separated-values parsing and writing" | 
					
						
							|  |  |  | "The " { $vocab-link "csv" } " vocabulary can read and write CSV (comma-separated-value) files." $nl | 
					
						
							|  |  |  | "Reading a csv file:" | 
					
						
							|  |  |  | { $subsection file>csv } | 
					
						
							|  |  |  | "Writing a csv file:" | 
					
						
							|  |  |  | { $subsection csv>file } | 
					
						
							|  |  |  | "Changing the delimiter from a comma:" | 
					
						
							|  |  |  | { $subsection with-delimiter } | 
					
						
							|  |  |  | "Reading from a stream:" | 
					
						
							|  |  |  | { $subsection csv } | 
					
						
							|  |  |  | "Writing to a stream:" | 
					
						
							|  |  |  | { $subsection write-csv } ;
 | 
					
						
							| 
									
										
										
										
											2008-07-25 17:02:07 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-30 20:23:04 -05:00
										 |  |  | ABOUT: "csv" |