Documentation

23.1 EDoc (classic)

rebar3 edoc → doc/index.html.

%% @doc Computes the area of a shape.
%% @param Shape a tagged tuple.
%% @returns the area as a float.
-spec area(shape()) -> float().

23.2 -doc attributes (OTP 27+)

1> shapes:area({circle, 1}). 3.141592653589793 Docs are stored in the BEAM file (EEP-48 chunks), visible in the shell via h(shapes, area). and rendered by ExDoc (rebar3 ex_doc) — the same format used across Erlang, Elixir and Gleam on hexdocs.pm.

-module(shapes).
-moduledoc """
Geometry helpers.
""".

-doc """
Computes the area of a `Shape`.

## Example
""".
-spec area(shape()) -> float().
area(Shape) -> ...

🧪 Part II Exercises

Define a #book{} record and write functions to add, find (by ISBN), and list books in a library (list of records).

Rewrite exercise 1 using maps; compare.

Write a word-frequency counter for a text file using maps; print the top 10.

Parse a simple binary protocol: <<Type:8, Len:16, Payload:Len/binary>> messages from a stream.

Write a CSV parser returning a list of maps (header row = keys), handling quoted fields.

Implement a priority queue on top of gb_trees.

Add specs to all your functions and get a clean rebar3 dialyzer run.

Write EUnit tests with fixtures for exercises 1–3.

Write a PropEr property verifying your merge sort against lists:sort/1.

Build an escript that reads Erlang terms from a file with file:consult/1 and pretty-prints them as JSON (OTP 27 json module).