Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 196 lines (173 sloc) 6.05 KB
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">
<title>Erlang Libraries</title>
<prepared>Matthias Lang</prepared>
<section><title> What's in the OTP libraries?</title>
The full library descriptions are included with the open-source
distribution and also
<url href="">
on line</url>. The highlights are:
<title>O&amp;M Support</title>
SASL, EVA, INETS and SNMP provide
Operations- and maintenance-related functionality:
release handling, alarm and event handling,
administration via web browser and SNMP.
ORBER, CosEvent, CosTransactions and IC
contain support for everything CORBA related.
Mnesia and Mnemosyne provide a real-time distributed
database which can be both in-RAM and on-disk.
There is also a standard ODBC client driver.
There is an ASN.1 compiler which produces Erlang code.
<title>Standard Library</title>
A rich collection of modules provides
everything from string, list and regular expression
manipulation to random number generation and calendar
<title>Structural Components</title>
gen_server, gen_fsm,
and supervision trees provide standard ways of implementing
client/server subsystems, state machines and
supervised fault-tolerant systems.
<title>GUI and Graphics</title>
wx, gs and webtool provide ways to build a gui.
Among other things, there are also HTTP, SSH and FTP servers.
<section><title> Is there a collection of data structures, e.g. balanced trees?</title>
Linked lists are a fundamental part of Erlang, as are tuples.
The other standard data structures are:
<cell>sets, i.e. a collection of unique elements.</cell>
<cell>sets, but based on a general balanced data structure</cell>
<cell>a general balanced tree</cell>
<cell>maps, also called associative arrays</cell>
<cell>hash tables and ordered sets (trees)</cell>
<cell>on-disk hash tables</cell>
<tcaption>Standard data structures</tcaption>
The <url href="">
contributions area</url>
at the site includes modules for
double-ended queues and balanced trees.
<c>ordset</c> and <c>orddict</c> are
not really suitable for large amounts of data: they are no
better that lists for many common operations, e.g.
inserting an element is O(n) for both. <c>dict</c>
and <c>sets</c> are usually preferred.
In practice, Erlang programs use lists (either natively or
via <c>dict</c>) for data structures involving
up to a few hundred elements and use <c>ETS</c>
(the Erlang Term Store) or mnesia
for anything larger. ETS uses hashing to allow near
constant-time access to almost arbitrarily large amounts of data.
For a collection of data consisting of a few (tens or
hundreds) items, lists often outperform both ETS and
trees. For large numbers of small items, ETS tends to
work best. For larger items, balanced trees can outperform
ETS because they avoid copying the data.
<section><title>Is there a serial port driver for Erlang?</title>
Johan Bevemyr wrote one which works for unix machines. The
code is freely available at
<url href=""> the contributions
area</url> as <em>serial-1.0</em>.
There have been discussions on the mailing list about writing
a more general driver which also works on windows machines.
Nothing much has come of this (lack of interest?).
<section><title>Is there a toolkit for building GUIs?</title>
There are several.
The <url
application lets you make GUIs with <url href="">
wxWidgets</url>, a
cross-platform toolkit. wxErlang is part of the OTP
The older <url
href="">gs</url> application
uses TK as a backend. Some people prefer to work with TK
through <url href="">
etk</url>. ETK is a fairly direct binding to the TK toolkit.
Other graphics-related items on
<url href="">sourceforge</url>
are gtkNode (a C node which gives access to a large subset of GTK2) and
gd1_drv (a driver which dynamically creates JPEG and PNG images).
There are a few projects involving experimental graphics
interfaces, including a binding to gtk (Ed: can someone
send me some more information about this!), an <url
href="">OpenGL modeller</url>
and some <url href="">
interesting work</url> to directly access the X protocol.
<section><title>I've written a library to handle XYZ. How do I get it into the standard Erlang distribution?</title>
This takes more work and patience than most people
have. Kent Boortz described many of the hurdles
<url href="">on the mailing list</url>.
There are other ways to spread your code, including
distributing it from your own website or adding it to
the <url href="">jungerl</url>.