-# $Id: Makefile.config,v 1.1 2006-11-24 09:43:15 rich Exp $
+# $Id: Makefile.config,v 1.2 2006-11-24 13:58:56 rich Exp $
PACKAGE := ocaml-csv
-VERSION := 1.1.3
+VERSION := 1.1.4
(* Handy tool for managing CSV files.
- * $Id: csvtool.ml,v 1.6 2006-11-24 10:09:56 rich Exp $
+ * $Id: csvtool.ml,v 1.7 2006-11-24 13:58:56 rich Exp $
*)
open Printf
match csv with
| [] -> failwith "no rows in this CSV file"
| h :: t -> h, t in
+ (* Do the headers requested exist in the CSV file? If not,
+ * throw an error.
+ *)
+ List.iter (
+ fun name ->
+ if not (List.mem name header) then
+ failwith ("namedcol: requested header not in CSV file: " ^ name)
+ ) names;
let data = associate header data in
let data = List.map (
fun row -> List.map (fun name -> List.assoc name row) names