@@ -12,9 +12,10 @@ value as the notes will make sense for me as I cherry pick a sentence or an anal
12
12
Moreover, don't expect direct quotes, changing the sentences vocbulary helps me personally.
13
13
14
14
<details >
15
- <summary >
16
- ### Chapter 1 - The language of macros
17
- </summary >
15
+ <summary >Chapter 1 - The language of Macros</summary >
16
+
17
+ <details >
18
+ <summary >What are Macros?</summary >
18
19
19
20
- Macros are code that write code.
20
21
- Elixir itself is made with macros, as a result you can extend the language itself
34
35
" <div><h1 class=\" title\" >Hello</h1><p>Metaprogramming Elixir</p></div>"
35
36
```
36
37
37
- #### The Abstract Syntax Tree
38
+ </details >
39
+
40
+ <details >
41
+ <summary >The Abstract Syntax Tree</summary >
38
42
39
43
- Most languages use AST but you never need to know about them. They are used typically during compilation
40
44
or interpretation to transform source code into a tree structure before being turned into bytecode
@@ -59,7 +63,10 @@ iex> quote do: div(10, 2)
59
63
- The purpose of macros is to interact with this AST with the syntax of Elixir.
60
64
- Macros turn you from language consumer to language creator. You have the same level of power as José when he wrote the standard library.
61
65
62
- #### Trying It All Together
66
+ </details >
67
+
68
+ <details >
69
+ <summary >Trying It All Together</summary >
63
70
64
71
"Let's write a macro that can print the spoken form of an Elixir mathematical expression, such as 5 + 2, when calculating a result.
65
72
In most languages, we would have to parse a string expression into something digestible by our program. With Elixir, we can access
@@ -142,3 +149,5 @@ Much like interpolation from Ecto and the difference between `"Hello world"` and
142
149
Back to the ` math.exs ` example.
143
150
144
151
</details >
152
+
153
+ </details >
0 commit comments