Advanced C++ programming styles and idioms
Advanced C++ programming styles and idioms
A model C++ tree iterator class for binary search trees
SIGCSE '97 Proceedings of the twenty-eighth SIGCSE technical symposium on Computer science education
Purely functional data structures
Purely functional data structures
Breadth-first numbering: lessons from a small exercise in algorithm design
ICFP '00 Proceedings of the fifth ACM SIGPLAN international conference on Functional programming
Proceedings of the 3rd ACM SIGPLAN international conference on Principles and practice of declarative programming
Journal of Functional Programming
Journal of Functional Programming
On the static and dynamic extents of delimited continuations
Science of Computer Programming
A Hoare Logic for Call-by-Value Functional Programs
MPC '08 Proceedings of the 9th international conference on Mathematics of Program Construction
Hi-index | 0.00 |
Iterating over the elements of an abstract collection is usually done in ML using a fold-like higher-order function provided by the data structure. This article discusses a different paradigm of iteration based on purely functional, immutable cursors. Contrary to fold-like iterators, the iteration can be cleanly interrupted at any step. Contrary to imperative cursors (such as those found in C++ and Java libraries) it is possible to backtrack the iterator to a previous step. Several ways to iterate over binary trees are examined and close links with Gérard Huet's Zipper are established. Incidentally, we show the well-known two-lists implementation of functional queues arising from a Zipper-based breadth-first traversal.