You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/lecture_07/lab.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,7 +122,7 @@ Ideally we would like write some macro `@poly` that takes a polynomial in a math
122
122
123
123
*Example usage*:
124
124
```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
126
126
```
127
127
128
128
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
263
263
Let's test it.
264
264
```@repl lab07_poly
265
265
using InteractiveUtils #hide
266
-
p = @poly x 3x^2 + 2x^1+ 10
266
+
p = @poly x 3x^2+2x^1+ 10
267
267
p(2) == evalpoly(2, [10,2,3])
268
268
@code_lowered p(2) # can show the generated code
269
269
```
@@ -456,6 +456,8 @@ where `Grass => 0.5` defines the behavior of the `eat!` function. The coefficien
456
456
end
457
457
```
458
458
459
+
**BONUS**:
460
+
You can try running the simulation with the newly added agents.
0 commit comments