From: "James H." Date: 2006-03-15T01:03:45+09:00 Subject: Re: Writing Good #each Methods? Concerning ordered elements, what is the best way to ascertain the order wherein the structure is not an array? For instance, suppose you had a link list. You *could* have a class variable that kept track of the beginning, but this would mean difficulties when you had more than one link list in play. In trying to solve the order issue (naively), I wrote a method like: def each(&block) current = self.previous until current.previous.nil? current = current.previous end # ... end This obviously doesn't work because on each call of #each, the focus is rewound to the intial element in the list. Any advice on the matter?