When Lists Become Bits
Prefix-freeness is the property that lifts the free-monoid construction into bit space.
Browse posts by tag
Prefix-freeness is the property that lifts the free-monoid construction into bit space.
The free monoid on a set is the type of lists over that set. The universal property says fold is the unique homomorphism from lists to any monoid. This explains why lists, multisets, and polynomials appear everywhere.
A homomorphism preserves structure. fold is the universal homomorphism from the free monoid. This is the algebraic reason that fold, evaluation, and parallelism work.
Online accumulators are monoids. Default construction is the identity, combination via += is the binary operation, and parallel composition gives the product monoid, computing arbitrary statistics in a single pass.
A reflection on eleven explorations in generic programming, and how algorithms arise from algebraic structure.
The Russian peasant algorithm computes products, powers, Fibonacci numbers, and more, once you see the underlying algebraic structure.