Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] [ANN] The Missing Library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-23 (18:52)
From: John Goerzen <jgoerzen@c...>
Subject: [Caml-list] [ANN] The Missing Library

Some of you may remember my complaints about missing functions in the
standard library.  To help address those, I have started work on my own
OCaml library to augment the standard functions.  You can obtain it,
along with online API docs covering every function, at: 


[Debian users: I have uploaded it to sid, but will take a few days to

Some excerpts from the README:

Missinglib is a collection of OCaml-related utilities.  The following
modules are are provided:

ConfigParser            System for parsing configuration files
Hashtbloper             Hash table convenience operators
Hashtblutil             Hash table utilities
Lexingutil              Lexing-related utilities
Listutil                List-manipulation utilities
Slice                   Underlying API for Slice operators
Sliceoper               Flexible subparts of arrays, lists, and strings
Streamutil              Stream parser utilities
Strutil                 String-related utilities

The entire library has no prerequisites save the OCaml standard library and
findlib and is designed to install without complexity on a variety of
systems.  It could also easily be embedded within your own source trees
so that users need not have it installed beforehand.


I would greatly appreciate constructive criticism on any aspect of the
package, especially the build system.  I have tried to make it possible
to "make; make install" on just about any platform, regardless of
availability of ocamlopt.  It took some hoop-jumping, though, so
suggestions are welcome :-)

Some basic info on the modules present: The ConfigParser module can read
and write sectioned .INI-style files and is mostly compatible with
Python's ConfigParser module.  Sliceoper defines some more powerful ways
of indexing arrays, lists, and strings (some of these concepts were
discussed on this list).  Strutil provides functions like strip, lstrip,
and rstrip (removes whitespace from either end, beginning, or end, of a
string).  Listutil provides a "replace" that is analogous to
Hashtbl.replace, but for association lists; and "sub" that is similar to
String.sub or Array.sub.  Hashtbloper defines some more useful ways of
working with hash tables, such as:

  hash /> 5 

   is the same as: 

  Hashtbl.find hash 5 

    let sections = Hashtbl.create 5;;
    let options = Hashtbl.create 5;;
    Hashtbl.replace options "option1" "value1";;
    Hashtbl.replace sections "section1" options;;
    sections /> "section1" /> "option1";;
                 returns "value1" 

   let newhash = hash // ("key", "value");; 

      (Copies hash, adds the pair to the copy, and returns it -- similar
       in concept to :: for lists)

BTW, is this list the right place for a message like this?

-- John

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: