Just for a bit a fun i've implemented a simple doubly linked list and trying out some range based stuff. Whilst doing so i have some questions which you guys might be able to answer.

1. In your opinion when accessing the elements of a linked list should they yield the data stored within the nodes or the entire nodes themselves? Different languages do this differently. For example, C# yields nodes[1], Java yields data[2].

2. Suppose when accessing my linked list, it yields data and not nodes, how do iterate in reverse? I don't want to add unnecessary methods or properties.

3. How would you implement the 'save' method of a forward range in the context of a linked list? If my understanding is correct the 'saved' range is iterated and discard, so cannot use any references to the underlying range. This might also solve question 2.

[1]: http://msdn.microsoft.com/en-us/library/he2s3bh7(v=vs.110).aspx [2]: http://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html

Reply via email to