Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update second-iter.md #306

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/second-iter.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

Alright, let's try to implement Iter. This time we won't be able to rely on
List giving us all the features we want. We'll need to roll our own. The
basic logic we want is to hold a pointer to the current node we want to yield
next. Because that node may not exist (the list is empty or we're otherwise
done iterating), we want that reference to be an Option. When we yield an
element, we want to proceed to the current node's `next` node.
basic logic we want is to hold a pointer to the current node in the list, and
every time we ask for the next element, it will return the current node’s value
and move to the next node in the list. Because that node may not exist (the list
is empty or we're otherwise done iterating), we want that reference to be an
Option. When we yield an element, we want to proceed to the current node's `next` node.

Alright, let's try that:

Expand Down