Skip to content

Commit 90a4230

Browse files
committed
Lab7: Remove spaces in poly exercise.
Added bonus exercise for eats macro.
1 parent 65a790c commit 90a4230

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/src/lecture_07/lab.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Ideally we would like write some macro `@poly` that takes a polynomial in a math
122122

123123
*Example usage*:
124124
```julia
125-
p = @poly x 3x^2 + 2x^1 + 10x^0 # the first argument being the independent variable to match
125+
p = @poly x 3x^2+2x^1+10x^0 # the first argument being the independent variable to match
126126
```
127127

128128
However in order to make this happen, let's first consider much simpler case of creating the same but without the need for parsing the polynomial as a whole and employ the fact that macro can have multiple arguments separated by spaces.
@@ -263,7 +263,7 @@ end
263263
Let's test it.
264264
```@repl lab07_poly
265265
using InteractiveUtils #hide
266-
p = @poly x 3x^2 + 2x^1 + 10
266+
p = @poly x 3x^2+2x^1+ 10
267267
p(2) == evalpoly(2, [10,2,3])
268268
@code_lowered p(2) # can show the generated code
269269
```
@@ -456,6 +456,8 @@ where `Grass => 0.5` defines the behavior of the `eat!` function. The coefficien
456456
end
457457
```
458458

459+
**BONUS**:
460+
You can try running the simulation with the newly added agents.
459461

460462
```@raw html
461463
</div></div>

0 commit comments

Comments
 (0)