caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] [ANN] Sequence 0.3.1
@ 2013-02-15 17:49 Simon Cruanes
  0 siblings, 0 replies; only message in thread
From: Simon Cruanes @ 2013-02-15 17:49 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-02-15 17:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-15 17:49 [Caml-list] [ANN] Sequence 0.3.1 Simon Cruanes

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).