Merge pull request #25 from AndrewWasHere/ranges

Ranges chapter edits.
This commit is contained in:
john verzani 2022-08-25 16:17:02 -04:00 committed by GitHub
commit c93962ba49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -320,7 +320,7 @@ In this example, we use the fact that `rem(k, 7)` returns the remainder found fr
sum(k for k in 1:100 if rem(k,7) == 0) ## add multiples of 7
```
The same `if` can be used in a comprehension. For example, this is an alternative to `filter` for identifying the numbers divisble by `7` in a range of numbers:
The same `if` can be used in a comprehension. For example, this is an alternative to `filter` for identifying the numbers divisible by `7` in a range of numbers:
```{julia}
@ -330,7 +330,7 @@ The same `if` can be used in a comprehension. For example, this is an alternativ
#### Example: Making change
This example of Stefan Karpinski comes from a [blog](http://julialang.org/blog/2016/10/julia-0.5-highlights) post highlighting changes to the `Julia` language with version `v"0.5.0"`, which added features to comprehensions that made this example possible.
This example of Stefan Karpinski's comes from a [blog](http://julialang.org/blog/2016/10/julia-0.5-highlights) post highlighting changes to the `Julia` language with version `v"0.5.0"`, which added features to comprehensions that made this example possible.
First, a simple question: using pennies, nickels, dimes, and quarters how many different ways can we generate one dollar? Clearly $100$ pennies, or $20$ nickels, or $10$ dimes, or $4$ quarters will do this, so the answer is at least four, but how much more than four?
@ -506,7 +506,7 @@ Does vector addition work? as expected? In particular, is the result of `(1:4) +
yesnoq(true)
```
What if parenthese are left off? Explain the output of `1:4 + 2:5`?
What if parentheses are left off? Explain the output of `1:4 + 2:5`?
```{julia}