A lightweight, modular standard library extension, string library, and interfaces to various libraries (unix, threads, etc.) BSD license.
Find a file
2014-05-20 19:23:46 +02:00
cgi moved some files into lwt/ subdir; 2014-05-12 15:23:54 +02:00
core bool and int modules 2014-05-20 19:23:46 +02:00
examples moved cgi in a subdir (would not build with oasis 0.4 otherwise) 2013-12-30 12:20:05 +01:00
lwt moved some files into lwt/ subdir; 2014-05-12 15:23:54 +02:00
misc merge with master (AVL) 2014-05-20 15:59:49 +02:00
string fixed warnings in Levenshtein 2014-05-17 09:53:21 +02:00
tests updated and fixed things in core/: 2014-05-17 01:00:00 +02:00
threads moved some files into lwt/ subdir; 2014-05-12 15:23:54 +02:00
.gitignore qtest 2014-05-12 15:30:13 +02:00
.header Cause: debugging experiment, tracking why values exist and actions were performed 2014-04-23 17:59:43 +02:00
.merlin enable warnings 2014-05-17 00:59:07 +02:00
.ocamlinit more modules in containers_string (CCString, Levenshtein); CCFun.finally 2014-05-17 00:10:47 +02:00
_oasis bool and int modules 2014-05-20 19:23:46 +02:00
_tags enable warnings 2014-05-17 00:59:07 +02:00
configure moved cgi in a subdir (would not build with oasis 0.4 otherwise) 2013-12-30 12:20:05 +01:00
containers.mllib moved cgi in a subdir (would not build with oasis 0.4 otherwise) 2013-12-30 12:20:05 +01:00
containers.mlpack circular lists 2014-05-12 14:45:12 +02:00
containers.odocl circular lists 2014-05-12 14:45:12 +02:00
containers_cgi.mllib use oasis to build files, splitted into libraries, including 2013-10-18 22:27:43 +02:00
containers_lwt.mllib Lwt_automaton, for an interface with Lwt 2013-12-30 16:24:18 +01:00
containers_lwt.mlpack Lwt_automaton, for an interface with Lwt 2013-12-30 16:24:18 +01:00
LICENSE gitignore and update of readme; added LICENSE file (BSD) 2013-02-27 16:12:14 +01:00
Makefile more modules in containers_string (CCString, Levenshtein); CCFun.finally 2014-05-17 00:10:47 +02:00
META moved futures into threads/ and updated oasis; added benchmark for Conv 2014-03-01 16:30:52 +01:00
README.md HGraph draft, a generalized hypergraph structure. Yay. 2013-11-25 17:48:03 +01:00
setup.ml moved some files into lwt/ subdir; 2014-05-12 15:23:54 +02:00
thread_containers.mllib renamed Futures into Future 2013-03-20 15:27:44 +01:00
thread_containers.odocl more modular build system, for thread-dependent or React-dependent modules 2013-05-31 11:41:43 +02:00

ocaml-containers

A bunch of containers,written in different occasions. Not all containers are properly tested (see tests/ and make tests if you have installed OUnit).

The documentation can be found here.

The design is mostly centered around polymorphism rather than functors. Such structures comprise:

  • PHashtbl, a polymorphic hashtable (with open addressing)
  • SplayTree, a polymorphic splay heap implementation (not quite finished)
  • SplayMap, a polymorphic functional map based on splay trees
  • Heap, an imperative heap based on SplayTree
  • Graph, a polymorphic imperative directed graph (on top of PHashtbl)
  • Hashset, a polymorphic imperative set on top of PHashtbl
  • LazyGraph, a lazy graph structure on arbitrary (hashable+eq) types, with basic graph functions that work even on infinite graphs, and printing to DOT.
  • FQueue, a purely functional queue structure
  • Heap, a purely functional polymorphic heap
  • Bij, a GADT-based bijection language used to serialize/deserialize your data structures
  • RAL, a random-access list structure, with O(1) cons/hd/tl and O(ln(n)) access to elements by their index.
  • Leftistheap, a polymorphic heap structure.
  • SmallSet, a sorted list implementation behaving like a set.
  • AbsSet, an abstract Set data structure, a bit like LazyGraph.

Other structures are:

  • Univ, a universal type encoding with affectation
  • Cache, a low level memoization cache for unary and binary functions
  • PersistentHashtbl, a semi-persistent hashtable (similar to persistent arrays)
  • Deque, an imperative double ended FIFO (double-linked list)
  • Future, a set of tools for preemptive threading, including a thread pool, monadic futures, and MVars (concurrent boxes)
  • Vector, a growable array (pure OCaml, no C; not tested)
  • FlatHashtbl, a (deprecated) open addressing hashtable with a functorial interface (replaced by PHashtbl)
  • Gen and Sequence, generic iterators structures.
  • UnionFind, a functorial imperative Union-Find structure.
  • HGraph, a structure of generalized hypergraphs

Some serialisation formats are also implemented, with a streaming, non-blocking interface that allows the user to feed the input in chunk by chunk (useful in combination with Lwt/Async). Currently, the modules are:

There is a QuickCheck-like library called QCheck.

Use

You can either build and install the library (see Build), or just copy files to your own project. The last solution has the benefits that you don't have additional dependencies nor build complications (and it may enable more inlining). I therefore recommand it for its simplicity.

If you have comments, requests, or bugfixes, please share them! :-)

Build

There are no dependencies (Sequence is included). The Bij module requires OCaml >= 4.00. Type:

$ make

To build and run tests (requires oUnit):

$ opam install oUnit
$ make tests
$ ./tests.native

To build the small benchmarking suite (requires Bench):

$ opam install bench
$ make bench
$ ./benchs.native

License

This code is free, under the BSD license.