Publication View

The Under-Appreciated Unfold (1999)

Abstract
Folds are appreciated by functional programmers. Their dual, unfolds, are not new, but they are not nearly as well appreciated. We believe they deserve better. To illustrate, we present (indeed, we calculate) a number of algorithms for computing the breadth-first traversal of a tree. We specify breadth-first traversal in terms of level-order traversal, which we characterize first as a fold. The presentation as a fold is simple, but it is inefficient, and removing the inefficiency makes it no longer a fold. We calculate a characterization as an unfold from the characterization as a fold; this unfold is equally clear, but more efficient. We also calculate a characterization of breadth-first traversal directly as an unfold; this turns out to be the `standard' queue-based algorithm.

Publication details
Download http://citeseer.ist.psu.edu/283921.html
Source http://web.comlab.ox.ac.uk/oucl/work/jeremy.gibbons/publications/unfold.ps.gz
Publisher unknown
Contributors The Pennsylvania State University CiteSeer Archives
Repository CiteSeer (United States)
Keywords Jeremy Gibbons,Geraint Jones The Under-Appreciated Unfold
Language Englisch
Relation oai:CiteSeerPSU:125338, oai:CiteSeerPSU:343126, oai:CiteSeerPSU:35189, oai:CiteSeerPSU:224438, oai:CiteSeerPSU:158610, oai:CiteSeerPSU:323915, oai:CiteSeerPSU:365371