A lightweight, modular standard library extension, string library, and interfaces to various libraries (unix, threads, etc.) BSD license.
Find a file
2013-08-28 15:03:05 +02:00
examples example updated 2013-03-31 22:46:14 +02:00
tests renamed Graph to PersistentGraph, not to collide with OCamlGraph 2013-06-13 15:17:52 +02:00
.gitignore target for documentation of some modules 2013-04-03 00:01:52 +02:00
.merlin Behavior is now based on Lwt rather than React, using futures. 2013-06-05 11:06:16 +02:00
.ocamlinit aesthetic in Bencode 2013-06-12 19:35:48 +02:00
_tags Behavior is now based on Lwt rather than React, using futures. 2013-06-05 11:06:16 +02:00
absSet.ml new container, AbsSet, that presents an abstract view of sets 2013-08-20 23:33:14 +02:00
absSet.mli new container, AbsSet, that presents an abstract view of sets 2013-08-20 23:33:14 +02:00
behavior.ml Behavior is now based on Lwt rather than React, using futures. 2013-06-05 11:06:16 +02:00
behavior.mli Behavior is now based on Lwt rather than React, using futures. 2013-06-05 11:06:16 +02:00
bencode.ml cosmetic changes in Bencode 2013-06-27 16:13:10 +02:00
bencode.mli cosmetic changes in Bencode 2013-06-27 16:13:10 +02:00
bij.ml added a few helpers to Bij 2013-05-20 12:36:55 +02:00
bij.mli export Bij.t as a private type 2013-05-20 17:31:43 +02:00
cache.ml changed interface of Cache.S.with_cache_rec 2013-03-07 18:12:35 +01:00
cache.mli correct comments for ocamldoc 2013-03-22 17:42:09 +01:00
cC.ml added CC (congruence closure with curryfied terms); 2013-04-17 15:43:19 +02:00
cC.mli added CC (congruence closure with curryfied terms); 2013-04-17 15:43:19 +02:00
containers.mllib new container, AbsSet, that presents an abstract view of sets 2013-08-20 23:33:14 +02:00
containers.odocl new container, AbsSet, that presents an abstract view of sets 2013-08-20 23:33:14 +02:00
deque.ml rewrote Deque to be safe (no Obj anymore); 2013-03-14 14:14:13 +01:00
deque.mli rewrote Deque to be safe (no Obj anymore); 2013-03-14 14:14:13 +01:00
fHashtbl.ml added a is_empty function for FHashtbl; 2013-03-10 15:04:38 +01:00
fHashtbl.mli added a is_empty function for FHashtbl; 2013-03-10 15:04:38 +01:00
flatHashtbl.ml fixed bug in FlatHashtbl.remove 2013-03-07 10:12:47 +01:00
flatHashtbl.mli fixed .odocl and minor stuff 2013-06-12 17:36:59 +02:00
fQueue.ml added a functional Queue implementation 2013-03-09 20:35:45 +01:00
fQueue.mli added a functional Queue implementation 2013-03-09 20:35:45 +01:00
future.ml cleanup of LazyGraph 2013-03-29 23:16:17 +01:00
future.mli target for documentation of some modules 2013-04-03 00:01:52 +02:00
gen.ml added Gen.compare and Gen.eq functions 2013-04-02 23:48:51 +02:00
gen.mli doc for infix functions of Gen 2013-04-03 00:14:48 +02:00
hashset.ml hashset.union/inter take an optional argument for the resulting set 2013-03-04 17:30:34 +01:00
hashset.mli correct comments for ocamldoc 2013-03-22 17:42:09 +01:00
heap.ml leaner Heap 2013-03-20 15:54:45 +01:00
heap.mli copied code of SplayTree into Heap, to reduce dependencies 2013-03-20 15:49:52 +01:00
json.ml forgot the case for strings 2013-04-12 18:19:55 +02:00
json.mli basic json parser/printer using Genlex 2013-04-12 18:12:33 +02:00
lazyGraph.ml LazyGraph.limit_depth implemented 2013-03-31 22:23:26 +02:00
lazyGraph.mli target for documentation of some modules 2013-04-03 00:01:52 +02:00
leftistheap.ml added filter to leftistheap 2013-08-20 12:15:35 +02:00
leftistheap.mli added filter to leftistheap 2013-08-20 12:15:35 +02:00
LICENSE gitignore and update of readme; added LICENSE file (BSD) 2013-02-27 16:12:14 +01:00
lwt_containers.mllib Behavior is now based on Lwt rather than React, using futures. 2013-06-05 11:06:16 +02:00
lwt_containers.odocl Behavior is now based on Lwt rather than React, using futures. 2013-06-05 11:06:16 +02:00
Makefile Behavior is now based on Lwt rather than React, using futures. 2013-06-05 11:06:16 +02:00
multiSet.ml is_empty in Multiset 2013-07-07 00:19:47 +02:00
multiSet.mli is_empty in Multiset 2013-07-07 00:19:47 +02:00
persistentGraph.ml renamed Graph to PersistentGraph, not to collide with OCamlGraph 2013-06-13 15:17:52 +02:00
persistentGraph.mli renamed Graph to PersistentGraph, not to collide with OCamlGraph 2013-06-13 15:17:52 +02:00
persistentHashtbl.ml added PersistentHashtbl, adapted from persistent arrays of J-C Filliatre 2013-03-26 17:23:19 +01:00
persistentHashtbl.mli added PersistentHashtbl, adapted from persistent arrays of J-C Filliatre 2013-03-26 17:23:19 +01:00
pHashtbl.ml updated benchmark 2013-03-05 00:55:24 +01:00
pHashtbl.mli correct comments for ocamldoc 2013-03-22 17:42:09 +01:00
piCalculus.ml PiCalculus module, to emulate the Pi-calculus concurrency model; 2013-05-20 19:17:20 +02:00
piCalculus.mli PiCalculus module, to emulate the Pi-calculus concurrency model; 2013-05-20 19:17:20 +02:00
puf.ml added CC (congruence closure with curryfied terms); 2013-04-17 15:43:19 +02:00
puf.mli added CC (congruence closure with curryfied terms); 2013-04-17 15:43:19 +02:00
RAL.ml added Random-Access list implementation 2013-07-01 14:22:09 +02:00
RAL.mli added Random-Access list implementation 2013-07-01 14:22:09 +02:00
README.md new container, AbsSet, that presents an abstract view of sets 2013-08-20 23:33:14 +02:00
sequence.ml updated version of Sequence 2013-08-28 15:03:05 +02:00
sequence.mli updated version of Sequence 2013-08-28 15:03:05 +02:00
sexp.ml Sexp module, for parsing and printing S-expressions incrementally 2013-06-25 16:22:34 +02:00
sexp.mli Sexp module, for parsing and printing S-expressions incrementally 2013-06-25 16:22:34 +02:00
skipList.ml faster SkipList.find 2013-03-23 01:45:46 +01:00
skipList.mli skipList module 2013-03-23 01:00:13 +01:00
smallSet.ml small set implementation, relying on a sorted list 2013-08-20 11:10:31 +02:00
smallSet.mli updated version of Sequence 2013-08-28 15:03:05 +02:00
splayMap.ml functorial version of SplayMap 2013-05-01 17:21:09 +02:00
splayMap.mli functorial version of SplayMap 2013-05-01 17:21:09 +02:00
splayTree.ml splay heaps are implemented 2013-03-05 11:05:00 +01:00
splayTree.mli splay heaps are implemented 2013-03-05 11:05:00 +01: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
unionFind.ml imperative UnionFind structure 2013-08-20 11:30:08 +02:00
unionFind.mli imperative UnionFind structure 2013-08-20 11:30:08 +02:00
univ.ml simpler Univ.unpack implementation 2013-05-24 13:44:56 +02:00
univ.mli cleanrer interface for Univ 2013-03-14 14:43:08 +01:00
utils.ml rewrote Deque to be safe (no Obj anymore); 2013-03-14 14:14:13 +01:00
vector.ml update of Vector, with more functions (length, rev, append_seq...) 2013-04-22 18:32:23 +02:00
vector.mli update of Vector, with more functions (length, rev, append_seq...) 2013-04-22 18:32:23 +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 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.

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:

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.