hammerlab/sosa

Name: sosa

Owner: Hammer Lab

Description: The Sane OCaml String API

Created: 2014-10-21 20:19:55.0

Updated: 2017-08-29 16:14:22.0

Pushed: 2017-08-24 20:07:34.0

Homepage: http://www.hammerlab.org/docs/sosa/master/index.html

Size: 316

Language: OCaml

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Sane OCaml String API

This library is a set of APIs defined with module types, and a set of modules and functors implementing one or more of those interfaces.

The APIs define what a character and a string of characters should be.

See the INSTALL file for build instructions and/or the documentation website.

The library is ?packed? in the Sosa toplevel module name.

Module Types (APIs)

We have, in the sub-module Api:

Implementations
Native OCaml Characters

The Native_character module implements BASIC_CHARACTER with OCaml's char type.

Native OCaml Strings

The Native_string module implements BASIC_STRING with OCaml's string type considered immutable (and hence Native_character).

Native Mutable OCaml Strings (Bytes)

The Native_bytes module implements BASIC_STRING and UNSAFELY_MUTABLE with OCaml's bytes type.

Lists Of Arbitrary Characters

List_of is a functor: BASIC_CHARACTER ? BASIC_STRING, i.e., it creates a string datastructure made of a list of characters.

Build From Basic Mutable Data-structures

The functor Of_mutable uses an implementation of MINIMALISTIC_MUTABLE_STRING to build a BASIC_STRING.

Integer UTF-8 Characters

The Int_utf8_character module implements BASIC_CHARACTER with OCaml integers (int) representing Utf8 characters (we force the handling of not more than 31 bits, even if RFC 3629 restricts them to end at U+10FFFF, c.f. also wikipedia). Note that the function is_whitespace considers only ASCII whitespace (useful while writing parsers for example).

Examples, Tests, and Benchmarks

See the file test/main.ml for usage examples, the library is tested with:

The tests depend on the Nonstd, unix, and bigarray libraries:

make test
./sosa_tests

and you may add the basic benchmarks to the process with:

./sosa_tests bench

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.