From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 07920BB83 for ; Thu, 27 Apr 2006 09:47:27 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k3R7lQYq030738 for ; Thu, 27 Apr 2006 09:47:26 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA09789 for ; Thu, 27 Apr 2006 09:47:26 +0200 (MET DST) Received: from out3.smtp.messagingengine.com (out3.smtp.messagingengine.com [66.111.4.27]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k3R7lPgT030732 for ; Thu, 27 Apr 2006 09:47:25 +0200 Received: from frontend2.internal (frontend2.internal [10.202.2.151]) by frontend1.messagingengine.com (Postfix) with ESMTP id 0EA0BD4D14D for ; Thu, 27 Apr 2006 03:47:24 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by frontend2.internal (MEProxy); Thu, 27 Apr 2006 03:46:37 -0400 X-Sasl-enc: g8VXseOjgt8wb7n+vTrA5nXe1vQtAwsQocoU85pScKs5 1146123995 Received: from [172.16.13.134] (burnham.ljcrf.edu [192.231.106.2]) by mail.messagingengine.com (Postfix) with ESMTP id 9F8FD105 for ; Thu, 27 Apr 2006 03:46:35 -0400 (EDT) Date: Thu, 27 Apr 2006 00:43:51 -0700 (PDT) From: Martin Jambon X-X-Sender: martin@droopy To: caml-list@inria.fr Subject: announcement - Col: from records to CSV and vice-versa Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at concorde with ID 4450770E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4450770D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; vice-versa:01 syntax:01 ocaml:01 ocaml:01 syntax:01 defines:01 ocamlfind:01 ocamlopt:01 camlp:01 -package:01 -linkpkg:01 intensively:01 gnuplot:01 short:01 tuples:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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