Zipper vs. iterator for walking over a list or tree
问题 Suppose I need to walk over a list or tree to read (but not modify) the data. I can use either an iterator or a Zipper. Does Zipper have any advantages aside from immutability in this case? 回答1: Do you need to backtrack or otherwise move around in the structure in a non-sequential order? Do you want to be able to traverse the structure multiple times without worrying about where you left the iteration? Do you want to avoid thinking about concurrent access or thread safety? Go with the zipper.