Menu

Hylic: A composable recursion system for Rust (separating tree, fold, and execution)

Reddit r/rust·u/simleiiiii·6 months ago
#C1JenIk9
#hylic#recursion#docs#fold#article
Reading 0:00
15s threshold

I’ve been working on a Rust library, and published yesterday, that decomposes general recursion, into three independent parts:

Tree/Graph structure ( Nodes and their child nodes; DAG only)

Fold logic (three closures: initialize intermediate result (heap), accumulate child results onto heap + a finalize step into the result type)

Execution strategy (Executor)

Project location:

Docs: https://hylic-recursion.github.io/hylic-docs/intro.html

Github: https://github.com/hylic-recursion/hylic

The idea is that instead of writing recursive functions directly, you define:

how your structure expands ( Treeish , morally N -> &[N] )

how results are combined ( Fold -- init+accumulate+finalize)

how traversal runs ( Executor )

These can then be recombined and transformed freely; they cover as far as I can see, any recursive computation pattern.

It ships a parallel executor that rivals handrolled rayon (see docs for benchmarks), so you get directly and for absolutely free, parallelization in your recursion.

I…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.