From: Martin Jambon <martin_jambon@emailuser.net>
To: caml-list@inria.fr
Subject: announcement - Col: from records to CSV and vice-versa
Date: Thu, 27 Apr 2006 00:43:51 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.63.0604270001530.15243@droopy> (raw)
Col is a syntax library for the conversion between lists of records and
CSV files with header. CSV (Comma-Separated Values) is a text format
supported by spreadsheet programs. "records" are represented as OCaml
records, tuples or objects, all being available and interconvertible.
main URL: http://martin.jambon.free.fr/ocaml.html#col
development/discussion wiki: http://ocaml.pbwiki.com/Col
For a demonstration of what the syntax can do, see
http://martin.jambon.free.fr/col-doc.html
Here is a short example which defines a list of 2 records and saves them:
(* File test.ml *)
type col t = { x : float;
y : float;
title "The Title" : string = "no title" }
let data =
let x = 1. in
[ T.create ~x ~y:2. ();
T.create ~y:4. ~x ~title:"line2" () ]
let _ = T.save_csv "data.csv" data
(* end *)
$ ocamlfind ocamlopt -o testcol test.ml -syntax camlp4o -package col -linkpkg
$ ./testcol
$ cat data.csv
x,y,"The Title"
1.,2.,"no title"
1.,4.,line2
$
This package is not well-documented but I have been using it intensively
with openoffice.org and gnuplot, and it is stable. My largest record type
has 49 fields and is still growing!
Have fun!
--
Martin Jambon, PhD
http://martin.jambon.free.fr
Edit http://wikiomics.org, bioinformatics wiki
reply other threads:[~2006-04-27 7:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.63.0604270001530.15243@droopy \
--to=martin_jambon@emailuser.net \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox