Two or more functions are mutually recursive when their definitions call one another in a cycle. Two algebraic data types can likewise be mutually recursive when constructors of each refer to the other. For alternating sequences
Zig a b and Zag b a, descending one constructor exchanges the type parameters; a pair of mapping functions must exchange its arguments correspondingly. A mutually recursive fold may have two independent result types : its handlers have types a -> s -> r and b -> r -> s, with empty results of types r and s. Equality of the two result types is not required by type inference. Articles by others on the same topic
Mutual recursion is a programming concept where two or more functions call each other in a circular manner to solve a problem. Unlike traditional recursion, where a function calls itself, mutual recursion involves multiple functions working together to break down a problem into smaller subproblems. In mutual recursion, one function may call another function that eventually calls back to the original function, creating a circular calling pattern.