From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 6D0B37F6CC for ; Mon, 2 Feb 2015 17:48:09 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of drupyog+caml@zoho.com) identity=pra; client-ip=74.201.84.156; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="drupyog+caml@zoho.com"; x-sender="drupyog+caml@zoho.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of drupyog+caml@zoho.com designates 74.201.84.156 as permitted sender) identity=mailfrom; client-ip=74.201.84.156; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="drupyog+caml@zoho.com"; x-sender="drupyog+caml@zoho.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@sender1.zohomail.com) identity=helo; client-ip=74.201.84.156; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="drupyog+caml@zoho.com"; x-sender="postmaster@sender1.zohomail.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AeAQDcqc9UnJxUyUpbhDGDAb8PiEkCgR5DAQEBAQERAQEBAQEGDQkJFC6EDAEBAQMBIyABNwMLCxgJHgMCAg8CNREGAQwGAgEBF4d9AQMBBAQIv2NwhGgCilgiKCWFOAELARgHjxBvgmiBQZADiDCBF4EEhCIhiEGDPYQRboJCAQEB X-IPAS-Result: A0AeAQDcqc9UnJxUyUpbhDGDAb8PiEkCgR5DAQEBAQERAQEBAQEGDQkJFC6EDAEBAQMBIyABNwMLCxgJHgMCAg8CNREGAQwGAgEBF4d9AQMBBAQIv2NwhGgCilgiKCWFOAELARgHjxBvgmiBQZADiDCBF4EEhCIhiEGDPYQRboJCAQEB X-IronPort-AV: E=Sophos;i="5.09,507,1418079600"; d="scan'208,217";a="98565791" Received: from sender1.zohomail.com ([74.201.84.156]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-MD5; 02 Feb 2015 17:48:08 +0100 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type; b=hYJc6hnu2M6BuWUC8A+oziOhkOhlZjinnmNnKPfjZE1OlUcSAoyMQDAPMrlP5sx9IdhPeNP4iuUW rs6L7Sp8yaofqdxtZ2NujWviBnazT3f3OdwE7h+IyaTDxl/0Vmvr Received: from [10.0.0.178] (ursae.inria.fr [128.93.132.58]) by mx.zohomail.com with SMTPS id 1422895684413457.0589819320246; Mon, 2 Feb 2015 08:48:04 -0800 (PST) Message-ID: <54CFAA41.20706@zoho.com> Date: Mon, 02 Feb 2015 17:48:01 +0100 From: Drup User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Dhek Uir , caml-list@inria.fr References: <54CF9B20.5040300@inria.fr> In-Reply-To: Content-Type: multipart/alternative; boundary="------------040507090809060603020306" X-ZohoMailClient: External X-Zoho-Virus-Status: 2 Subject: Re: [Caml-list] Simple compression library This is a multi-part message in MIME format. --------------040507090809060603020306 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit input/output_value are using Marshal under the hood, so it's going to be the same. However, be aware that marshall (and the _value functions) are quite unsafe. If you have an error in the data (or your change the representation in OCaml), you will have ... surprising errors (including segfaults). There are plenty of safer solutions for serialization (deriving, sexp, yojson, to name a few). Le 02/02/2015 17:05, Dhek Uir a écrit : > > > On Mon, Feb 2, 2015 at 4:43 PM, Jacques-Henri Jourdan > > wrote: > > Le 02/02/2015 16:39, Dhek Uir a écrit : > > I'm looking for a compression library such as camlzip to read/write > > compressed files (any lossless compression algorithm is fine), but > > having a function similar to Pervasives.output_value, which does not > > seem to be available in camlzip (and I do not see how I could easily > > implement it). > > > > Would it be simple to modify camlzip to add this function? I believe > > that if this were the case, then it would already have been > done, but > > I might be wrong. > > > > Otherwise, is there another OCaml library with an API very > similar to > > Pervasives'? I'd prefer a lightweight solution (avoiding Core and > > Batteries) if possible. > > Can't you do Marshal.to_string, and then use Camlzip on the generated > string ? > > Indeed, I can. I believe the hard part is actually the input_value > operation. > But I haven't looked enough into Marshal, maybe my solution can be > found there. --------------040507090809060603020306 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
input/output_value are using Marshal under the hood, so it's going to be the same.

However, be aware that marshall (and the _value functions) are quite unsafe. If you have an error in the data (or your change the representation in OCaml), you will have ... surprising errors (including segfaults).

There are plenty of safer solutions for serialization (deriving, sexp, yojson, to name a few).

Le 02/02/2015 17:05, Dhek Uir a écrit :


On Mon, Feb 2, 2015 at 4:43 PM, Jacques-Henri Jourdan <jacques-henri.jourdan@inria.fr> wrote:
Le 02/02/2015 16:39, Dhek Uir a écrit :
> I'm looking for a compression library such as camlzip to read/write
> compressed files (any lossless compression algorithm is fine), but
> having a function similar to Pervasives.output_value, which does not
> seem to be available in camlzip (and I do not see how I could easily
> implement it).
>
> Would it be simple to modify camlzip to add this function? I believe
> that if this were the case, then it would already have been done, but
> I might be wrong.
>
> Otherwise, is there another OCaml library with an API very similar to
> Pervasives'? I'd prefer a lightweight solution (avoiding Core and
> Batteries) if possible.

Can't you do Marshal.to_string, and then use Camlzip on the generated
string ?

 
Indeed, I can. I believe the hard part is actually the input_value operation.
But I haven't looked enough into Marshal, maybe my solution can be found there.

--------------040507090809060603020306--