concept bitstring in category erlang

appears as: bitstrings, A bitstring, bitstring, bitstring
Erlang and OTP in Action

This is an excerpt from Manning's book Erlang and OTP in Action.

2.2.2. Binaries and bitstrings

A binary is a sequence of unsigned 8-bit bytes, used for storing and processing chunks of data (often data that comes from a file or has been received over a network protocol). A bitstring is a generalized binary whose length in bits isn’t necessarily a multiple of 8; it can, for instance, be 12 bits long, consisting of one and a half bytes.

Arbitrary bitstrings are a more recent addition to the language, whereas whole-byte binaries have been around for many years; but to a programmer there is little difference on the surface, except that you can do some nifty things these days that used to be impossible. Because the syntax is the same, and the name binary is so ingrained, you rarely hear people (including us) talk about bitstrings unless they want to make a point about the more flexible length.

2.10.1. Building a bitstring

A bitstring is written as <<Segment1, ..., SegmentN>>, with zero or more segment specifiers between the double less-than/greater-than delimiters. The total length of the bitstring, in bits, is exactly the sum of the lengths of the segments.