Skip to content

Commit 396c0a0

Browse files
committed
Some small fixes
1 parent fbefbda commit 396c0a0

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

docs/src/lecture_03/exercises.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The universe of the Game of Life is an infinite, two-dimensional orthogonal grid
1010

1111
The first generation must be initialized. Every new generation is created by applying the above rules simultaneously to every cell in the previous generations; births and deaths occur simultaneously. The moment when this happens is called a tick. Since every generation depends only on the previous one, this process is a [Markov chain](https://en.wikipedia.org/wiki/Markov_chain).
1212

13-
The following few exercises will implement the Game of Life. We will consider finite university with periodic boundary conditions.
13+
The following few exercises will implement the Game of Life. We will consider finite universe with periodic boundary conditions.
1414

1515
```@raw html
1616
<div class = "exercise-body">
@@ -115,7 +115,7 @@ Write a function `willsurvive` that returns `true` if the cell will survive base
115115
<summary class = "solution-header">Solution:</summary><p>
116116
```
117117

118-
This function can be written using the `if-elseif-else` statement. Since `cell` is a boolean value, we do not need to compare with one as in `call == 1`.
118+
This function can be written using the `if-elseif-else` statement. Since `cell` is a boolean value, we do not need to compare with one as in `cell == 1`.
119119

120120
```julia
121121
function willsurvive(cell, k)

docs/src/lecture_03/functions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ end
4444
plus (generic function with 1 method)
4545
```
4646

47-
The example above contains the `println` function on the last line. However, if the function is called, nothing is printed into the REPL. The happened because expressions after the `return` keyword are never evaluated.
47+
The example above contains the `println` function on the last line. However, if the function is called, nothing is printed into the REPL. This is because expressions after the `return` keyword are never evaluated.
4848

4949
```jldoctest functions
5050
julia> plus(4, 5)
@@ -75,7 +75,7 @@ julia> typeof(ps)
7575
NTuple{4,Int64}
7676
```
7777

78-
Since the function returns a tuple, returned values can be directly unpacked into multiple variables. This can be done in the same way as unpacking [tuples](@ref Tuples).
78+
Note that the function returns `NTuple{4, Int64}` which is a compact way of representing the type for a tuple of length `N = 4` where all elements are of the same type. Since the function returns a tuple, returned values can be directly unpacked into multiple variables. This can be done in the same way as unpacking [tuples](@ref Tuples).
7979

8080
```jldoctest functions
8181
julia> x1, x2, x3, x4 = powers(2)
@@ -105,7 +105,7 @@ To use recursion, we have to split the computation into three parts:
105105
- `p > 0`: the function should be called recursively with arguments `x`, `p - 1` and the result should be multiplied by `x`.
106106
- `p < 0`: then it is equivalent to call the power function with arguments `1/x`, `-p`.
107107

108-
These three cases can be defined in one `if` condition as follows:
108+
These three cases can be defined using the `if-elseif` as follows:
109109

110110
```jldoctest functions_ex; output = false
111111
function power(x::Real, p::Integer)
@@ -401,7 +401,7 @@ julia> linear(2; a = 2, b = 4)
401401
The semicolon is not mandatory and can be omitted. Moreover, the order of keyword arguments is arbitrary. It is even possible to mix keyword arguments with positional arguments, as shown in the following example.
402402

403403
```jldoctest key_args
404-
julia> linear(b = 4, 2, a = 2) # If you use this, you will burn in hell. Also, Vasek does not check my changes :D
404+
julia> linear(b = 4, 2, a = 2) # If you use this, you will burn in hell :D
405405
8
406406
```
407407

@@ -714,7 +714,7 @@ Those two function declarations create functions with automatically generated na
714714
```@example
715715
using Plots
716716
717-
f(x,a) = (x+a)^2
717+
f(x,a) = (x + a)^2
718718
plot(-1:0.01:1, x -> f(x,0.5))
719719
720720
savefig("Plots.svg") # hide

docs/src/lecture_03/methods.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ The `supertypes_tree` function can be defined by:
116116

117117
```jldoctest methods; output = false
118118
function supertypes_tree(T::Type, level::Int = 0)
119-
T === Any && return
119+
isequal(T, Any) && return
120120
println(repeat(" ", level), T)
121121
supertypes_tree(supertype(T), level + 1)
122122
return
@@ -411,7 +411,7 @@ Write the `salary_yearly` function which computes the yearly salary for both stu
411411
<details class = "solution-body">
412412
<summary class = "solution-header">Solution:</summary><p>
413413
```
414-
Julia prefers to write many simple functions. We write `salary_yearly` based on the not-yet-defined `salary_yearly` function.
414+
Julia prefers to write many simple functions. We write `salary_yearly` based on the not-yet-defined `salary_monthly` function.
415415
```@example methods
416416
salary_yearly(s::Student) = 12*salary_monthly(s)
417417

0 commit comments

Comments
 (0)