Update paragraph describing Listing 10-1

Some readers may complain about this type of step-by-step paragraph, but
I think they are nice.  I have tried to rewrite this one with special
attention on the choice of words.  In the original version, the
following terms were all used to refer to an individual element of the
list:

- integer
- item
- number
- value

I think this is a clarity issue.  Yes, all these mean the same thing
(hey, you didn't use `element`!), but using four terms in one paragraph
to refer to the same thing seems untidy.  I replaced all instances of
`item` and `value` with `number` to match the caption for Listing 10-1.
I specifically left in the one instance of `integers`, because it
identifies the data type and the same sentence refers to the variable,
`numbers`.

If this was documentation rather than a book, I would expect fairly
strict standardization of terms like these, but in a book format it
seems like the original text may be acceptable.  Consider this "food for
thought" more than anything else.  It kind of applies book-wide.

Also, this entire section refers to a `vec![1, 2, ...]` as a "list"
while the section on vectors didn't really use that term at all.  Is
there a special distinction between "list" and "vector" here? Did
you clarify somewhere that the term "list" was going to be
interchangeable with "vector"? I haven't read all those sections so
I just don't know.
This commit is contained in:
Scott Abbey
2017-03-31 00:19:28 -05:00
parent 68bb38662a
commit 865b091db9

View File

@@ -65,13 +65,13 @@ fn main() {
<span class="caption">Listing 10-1: Code to find the largest number in a list
of numbers</span>
This code takes a list of integers, stored here in the variable `numbers`. It
puts the first item in the list in a variable named `largest`. Then it iterates
through all the numbers in the list, and if the current value is greater than
the number stored in `largest`, it replaces the value in `largest`. If the
current value is smaller than the largest value seen so far, `largest` is not
changed. When all the items in the list have been considered, `largest` will
hold the largest value, which in this case is 100.
This code begins with a list of integers in the variable `numbers`. It stores
the first number in the list in the variable named `largest`. Then it iterates
through all the numbers in the list. If the current number is greater than the
number stored in `largest`, it replaces the number in `largest`. If the current
number is smaller than the number stored in `largest`, nothing is changed. When
all the numbers in the list have been considered, `largest` will hold the
largest number, which in this case is 100.
If we needed to find the largest number in two different lists of numbers, we
could duplicate the code in Listing 10-1 and have the same logic exist in two