Chapter 5Records and Maps
So far we have talked about two containers for data, namely, tuples and lists. Tuples are used to store a fixed number of elements, and lists are used for a variable number of elements.
This chapter introduces records and maps. Records are really just tuples in disguise. Using records we can associate a name with each element in a tuple.
Maps are associative collections of key-value pairs. The key can be any Erlang term. In Perl and Ruby they are called hashes; in C++ and Java they are called maps, in Lua they are called tables, and in Python they are called dictionaries.
Using records and maps makes programming easier; instead of remembering where a data item is stored in a complex data structure, we just use ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access