Erlang Examples

ErlangOct 23, 2026

Erlang aligned plain-text table renderer

Renders headers and rows as a pipe-delimited table with each column padded to its widest cell.

formattingtablecli
000
ErlangOct 23, 2026

Erlang base64 encode and validated decode

Encodes binaries and iolists to Base64 and decodes strings safely, returning an error tuple on bad input.

decodingencodingbase64
000
ErlangOct 23, 2026

Erlang query string builder and parser

Encodes key-value pairs into a query string and parses a query string back into pairs with error handling.

query-stringurlparsing
000
ErlangOct 23, 2026

Erlang field-level input validation

Validates required and one-of fields and returns per-field error messages instead of raising exceptions.

inputerrorsvalidation
000
ErlangOct 23, 2026

Erlang JSON decode with error context

Decodes JSON and returns a clear error tuple with the reason and a short snippet of the invalid input.

parsingerrorsjson
000
ErlangOct 23, 2026

Erlang bounded worker pool collecting results

Runs tasks in batches of N linked processes, collecting every result or crash and enforcing a receive timeout.

concurrencypoolworkers
000
ErlangOct 23, 2026

Erlang httpc GET JSON with timeouts

Performs an HTTP GET with connect and request timeouts, checks the status, and decodes a JSON body.

httpjsontimeout
000
ErlangOct 23, 2026

Erlang env var config with validation

Reads environment variables with defaults and validates integer values against an inclusive range.

environmentconfigurationvalidation
000
ErlangOct 23, 2026

Erlang token bucket rate limiter

Refills tokens at a fixed average rate per second and allows bursts up to the configured bucket size.

concurrencytoken-bucketrate-limit
000
ErlangOct 23, 2026

Erlang bounded LRU cache with map and list

Keeps a map capped at N entries and moves every read or write to the front of the recency list.

boundedlrucache
000
ErlangOct 23, 2026

Erlang multi-key sort with nulls last

Sorts records by several map keys in order, comparing left to right and placing undefined values last.

mapssortingcomparator
000
ErlangOct 23, 2026

Erlang chunk a list into fixed batches

Splits any list into consecutive sublists of at most N elements, preserving order and keeping the leftover tail.

listschunkbatch
000
ErlangOct 23, 2026

Erlang stream a file line by line

Folds over a text file one line at a time using read_ahead buffering and trims trailing CRLF newlines.

streaminglinesfile-io
000
ErlangOct 23, 2026

Erlang deep clone and recursive map merge

Deep copies Erlang terms through a binary round-trip and recursively merges nested maps without mutating inputs.

mapsmergedeep-copyterms
000
ErlangOct 23, 2026

Erlang retry with capped exponential backoff

Runs a function with capped exponential backoff plus jitter, retrying failed attempts until the limit is reached.

error-handlingbackoffretryjitter
000