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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 4E53C7F20B for ; Fri, 15 Feb 2013 18:49:30 +0100 (CET) Received-SPF: Neutral (mail2-smtp-roc.national.inria.fr: domain of simon.cruanes.2007@m4x.org does not assert whether or not 129.104.30.34 is permitted sender) identity=pra; client-ip=129.104.30.34; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="SRS0=ZD6C=MH=m4x.org=simon.cruanes.2007@bounces.m4x.org"; x-sender="simon.cruanes.2007@m4x.org"; x-conformance=sidf_compatible; x-record-type="spf2.0" Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of SRS0=ZD6C=MH=m4x.org=simon.cruanes.2007@bounces.m4x.org designates 129.104.30.34 as permitted sender) identity=mailfrom; client-ip=129.104.30.34; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="SRS0=ZD6C=MH=m4x.org=simon.cruanes.2007@bounces.m4x.org"; x-sender="SRS0=ZD6C=MH=m4x.org=simon.cruanes.2007@bounces.m4x.org"; x-conformance=sidf_compatible; x-record-type="spf2.0" Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of postmaster@mx1.polytechnique.org designates 129.104.30.34 as permitted sender) identity=helo; client-ip=129.104.30.34; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="SRS0=ZD6C=MH=m4x.org=simon.cruanes.2007@bounces.m4x.org"; x-sender="postmaster@mx1.polytechnique.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ag0CAFl0HlGBaB4inGdsb2JhbABEwG4WDgEBAQEBCAsJCRQngk2BDhYYAwIBAgFVAwgBAYgODJwYoQkEjVeBcYMqA6oF X-IPAS-Result: Ag0CAFl0HlGBaB4inGdsb2JhbABEwG4WDgEBAQEBCAsJCRQngk2BDhYYAwIBAgFVAwgBAYgODJwYoQkEjVeBcYMqA6oF X-IronPort-AV: E=Sophos;i="4.84,674,1355094000"; d="scan'208";a="3089474" Received: from mx1.polytechnique.org ([129.104.30.34]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 15 Feb 2013 18:49:30 +0100 Received: from emmental.inria.fr (emmental.inria.fr [128.93.0.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id 0EBBE140D30F9 for ; Fri, 15 Feb 2013 18:49:05 +0100 (CET) Message-ID: <511E750E.7020308@m4x.org> Date: Fri, 15 Feb 2013 18:49:02 +0100 From: Simon Cruanes User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Fri Feb 15 18:49:10 2013 +0100 (CET)) X-Spam-Flag: No, tests=bogofilter, spamicity=0.001273, queueID=A59EF140D30E0 X-Org-Mail: simon.cruanes.2007@polytechnique.org Subject: [Caml-list] [ANN] Sequence 0.3.1 Hello, I'm happy to announce the release of Sequence 0.3.1. Sequence is designed to compose iterations over containers in a lightweight fashion. The goal is to transfer values between containers, or to apply transformations (map, filter, take, etc.) on several values without caring about where they come from. It doesn't have any dependencies. Sequence is not designed to be as general-purpose or flexible as, say, Batteries' `Enum.t`. Rather, it aims at providing a very simple and efficient way of iterating on a finite number of values, only allocating (most of the time) a few intermediate closures to do so. For instance, if you have an array and want to build a hashtable that contains elements mapping to their index in the array, you can write: > #require "sequence";; > let a = [| "a"; "b"; "c"; "d"; "e" |];; > let h = Hashtbl.create 3;; > Sequence.hashtbl_add h (Sequence.map (fun (x,y) -> y,x) (Sequence.of_array_i a));; > open Format;; (* to print h *) > let pp_pair formatter (x,y) = fprintf formatter "%s -> %i" x y;; > Sequence.pp_seq pp_pair std_formatter (Sequence.of_hashtbl h);; A toy S-expression module, and a few tests are included but not compiled by default (because they require OCaml >= 4.0). The code is free (BSD license), hosted at https://github.com/c-cube/sequence and available on OPAM (install with `opam install sequence`). Feedback, comments, discussion or Turing prize awards are welcome! Cheers! -- Simon Cruanes