@@ -33,7 +33,7 @@ f() = [i for i in 1:10]
3333@code_llvm debuginfo=:none f()
3434```
3535#### native code generation
36- ``` @repl lab06_intro
36+ ``` @ansi lab06_intro
3737@code_native debuginfo=:none f()
3838```
3939
@@ -124,13 +124,13 @@ In some cases the compiler uses loop unrolling[^1] optimization to speed up loop
124124 nothing #hide
125125 ```
126126
127- ```@repl lab06_intro
127+ ```@ansi lab06_intro
128128 @code_llvm debuginfo=:none polynomial(a,x)
129129 @code_llvm debuginfo=:none polynomial(ac,x)
130130 ```
131131
132132 More than 2x speedup
133- ```@repl lab06_intro
133+ ```@ansi lab06_intro
134134 @btime polynomial($a,$x)
135135 @btime polynomial($ac,$x)
136136 ```
@@ -201,7 +201,7 @@ Inlining[^2] is another compiler optimization that allows us to speed up the cod
201201 nothing #hide
202202 ```
203203
204- ```@repl lab06_intro
204+ ```@ansi lab06_intro
205205 @code_typed debuginfo=:none polynomial(a,x)
206206 ```
207207
@@ -211,7 +211,7 @@ Julia is so called homoiconic language, as it allows the language to reason abou
211211
212212There are two easy ways to extract/construct the code structure [ ^ 5 ]
213213- parsing code stored in string with internal ` Meta.parse `
214- ``` @repl lab06_meta
214+ ``` @ansi lab06_meta
215215code_parse = Meta.parse("x = 2") # for single line expressions (additional spaces are ignored)
216216code_parse_block = Meta.parse("""
217217begin
222222""") # for multiline expressions
223223```
224224- constructing an expression using ` quote ... end ` or simple ` :() ` syntax
225- ``` @repl lab06_meta
225+ ``` @ansi lab06_meta
226226code_expr = :(x = 2) # for single line expressions (additional spaces are ignored)
227227code_expr_block = quote
228228 x = 2
@@ -290,7 +290,7 @@ Following up on the more general substitution of variables in an expression from
290290 nothing #hide
291291 ```
292292 Given a function ` replace_i ` , which replaces variables ` i ` for ` k ` in an expression like the following
293- ```@repl lab06_meta
293+ ```@ansi lab06_meta
294294 ex = :(i + i* i + y* i - sin(z))
295295 @test replace_i(ex) == :(k + k* k + y* k - sin(z))
296296 ```
@@ -305,12 +305,12 @@ Following up on the more general substitution of variables in an expression from
305305
306306!!! details
307307 The naive solution
308- ```@repl lab06_meta
308+ ```@ansi lab06_meta
309309 sreplace_i(s) = replace(s, 'i' => 'k')
310310 @test Meta.parse(sreplace_i(s)) == replace_i(Meta.parse(s))
311311 ```
312312 does not work in this simple case, because it will replace "i" inside the ` sin(z) ` expression. We can play with regular expressions to obtain something, that is more robust
313- ```@repl lab06_meta
313+ ```@ansi lab06_meta
314314 sreplace_i(s) = replace(s, r"([ ^ \w ] |\b)i(?=[ ^ \w ] |\z)" => s"\1k")
315315 @test Meta.parse(sreplace_i(s)) == replace_i(Meta.parse(s))
316316 ```
0 commit comments