caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Simon Cruanes <simon.cruanes.2007@m4x.org>
To: caml-list@inria.fr
Subject: [Caml-list] [ANN] Sequence 0.3.1
Date: Fri, 15 Feb 2013 18:49:02 +0100	[thread overview]
Message-ID: <511E750E.7020308@m4x.org> (raw)

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


                 reply	other threads:[~2013-02-15 17:49 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=511E750E.7020308@m4x.org \
    --to=simon.cruanes.2007@m4x.org \
    --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;
as well as URLs for NNTP newsgroup(s).