corecursively
Corecursively is used to describe a definition or construction that is produced by corecursion, the dual concept to recursion. In corecursive definitions, outputs are generated progressively from a potentially infinite data structure rather than computed entirely from a finite input by reducing it. The term emphasizes the ongoing, producer-like nature of the definition.
Corecursion enables building infinite data structures, such as streams, by repeatedly applying a step that yields
From a formal perspective, corecursion is modeled in functional programming and category theory by unfold operations
Common examples include infinite streams of natural numbers defined corecursively, where each step yields the next
Caveats exist: non-productive or poorly guarded corecursive definitions can lead to non-terminating or meaningless results. Some
See also recursion, coinduction, anamorphism, coalgebra, streams.