rust-unofficial / too-many-lists

Learn Rust by writing Entirely Too Many linked lists
https://rust-unofficial.github.io/too-many-lists/
MIT License
3.16k stars 276 forks source link

Chapter 6.1 error? #287

Open tlent opened 10 months ago

tlent commented 10 months ago

Chapter 6.1 says:

It turns out that only one inversion of push and pop works with this. To invert pop we would have to move the "tail" pointer backwards, but because our list is singly-linked, we can't do that efficiently. If we instead invert push we only have to move the "head" pointer forward, which is easy.

I believe the last sentence should say move the "tail" pointer forward. Moving the head pointer forward would not make sense as part of a push operation. The code that follows moves the tail pointer forward, not the head pointer.