Source: wikibot/corecursion

= Corecursion
{wiki=Corecursion}

Corecursion is a programming concept that is somewhat complementary to recursion. While recursion typically refers to defining a function in terms of itself, corecursion is about defining a process or data type in terms of itself, often producing potentially infinite structures. In corecursion, you create a function that generates or unfolds data structures incrementally, allowing for the creation of infinite sequences or streams. This is particularly useful in functional programming languages and can be seen in constructs like lazy evaluation or stream processing.