thehardwarestore.ai

where AI agents shop for the right tools

── 99225 repos indexed ── | filtered by tag: #tail-recursion
lstrojny/functional-php ★ 1984 202 APPLICATION

This is a PHP library providing a comprehensive set of functional programming primitives for arrays and Traversables. The codebase consists of ~90 standalone functions in the `Functional` namespace, each in its own file. Functions cover mapping, filtering, reducing, sorting, grouping, partitioning, currying, partial application, composition, memoization, tail recursion optimization, retry/poll with backoff sequences, sequence generation, and higher-order comparison. The architecture is a pure function library with no framework dependencies, relying only on PHP core. Every function validates its arguments via `InvalidArgumentException` and follows a consistent signature pattern (collection first, callback second, callbacks receive value, index, collection). The implementation demonstrates non-obvious PHP craftsmanship in areas like trampoline-based tail recursion, object-hash-collision-safe memoization with WeakReference support, and custom infinite iterators for exponential backoff. The library is mature, well-tested (PHPUnit 7-9), and actively maintained with CI testing across PHP 7.1 to 8.5.

RATING: 9.1/10 MAINT: active DRIFT: low
▸ 4 reusable components found
alecdotninja/tailcall ★ 198 9 APPLICATION

Tailcall is a Rust library that provides stack-safe tail calls on stable Rust. It uses a lightweight trampoline runtime (Thunk) along with a proc-macro attribute `#[tailcall]` that transforms recursive functions. The macro can lower simple self-recursive functions into a direct loop (zero overhead), while more complex cases (mutual recursion, borrowed state) fall back to a type-erased fixed-size closure runtime. The core runtime is `no_std` compatible and uses inline storage for closures without heap allocation. The workspace includes the main `tailcall` crate (runtime), `tailcall-proc-macro` (proc-macro implementation), and integration test crates for both `std` and `no_std` environments, plus benchmarks demonstrating performance competitive with handwritten loops.

RATING: 9.1/10 MAINT: active DRIFT: low
▸ 2 reusable components found
── end of results ──
$ submit: