use-catalan 0.0.5

Utility-first Catalan-family scaffolding for RustUse
Documentation

use-catalan

Install

[dependencies]
use-catalan = "0.0.1"

Foundation

use-catalan provides a deliberately small exact-counting surface for Catalan-family sequences. The crate currently exposes catalan(n) for standard Catalan numbers and fuss_catalan(order, n) for the generalized Fuss-Catalan family. Results stay in checked u128 arithmetic, and overflow or invalid order values surface as explicit CatalanError values.

Helper group Primary items Best fit
Standard Catalan catalan, CatalanError Exact counts for binary-tree, Dyck-word, and balanced-parenthesization style problems
Generalized Catalan fuss_catalan Wider Catalan-family counts without a broader sequence toolbox

When to use directly

Choose use-catalan directly when Catalan-family sequence helpers are the only surface you need and you want to keep that concern explicit and narrow.

Scenario Use use-catalan directly? Why
You only need exact Catalan counts Yes The crate stays smaller than the facade and keeps the counting domain explicit
You need generalized Fuss-Catalan counts alongside standard Catalan numbers Yes The current surface already covers both without a broader sequence abstraction
You also need combinatorics, geometry, or other math domains Usually no use-math can unify the concrete surfaces behind feature flags

Scope

  • The current surface is intentionally small and concrete.
  • Sequence values use checked u128 arithmetic and return explicit errors at the boundary.
  • General combinatorics helpers and broader sequence APIs belong in adjacent focused crates.

Examples

Standard Catalan numbers

use use_catalan::catalan;

assert_eq!(catalan(4)?, 14);
assert_eq!(catalan(10)?, 16_796);

# Ok::<(), use_catalan::CatalanError>(())

Generalized Fuss-Catalan numbers

use use_catalan::fuss_catalan;

assert_eq!(fuss_catalan(2, 4)?, 14);
assert_eq!(fuss_catalan(3, 3)?, 12);

# Ok::<(), use_catalan::CatalanError>(())

Status

use-catalan is a concrete pre-1.0 crate in the RustUse docs surface. The API remains intentionally small while adjacent sequence and combinatorics crates continue to grow around it.