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: getting-started/basic-types.markdown
+2-2
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ iex> {1, 2, 3} # tuple
23
23
24
24
## Basic arithmetic
25
25
26
-
Open up `iex`and type the following expressions:
26
+
Open up `iex` and type the following expressions:
27
27
28
28
```iex
29
29
iex> 1 + 2
@@ -135,7 +135,7 @@ iex> "hellö"
135
135
"hellö"
136
136
```
137
137
138
-
> Note: if you are running on Windows, there is a chance your terminal does not use UTF-8 by default. You can change the encoding of your current session by running `chcp 65001` before entering iex.
138
+
> Note: if you are running on Windows, there is a chance your terminal does not use UTF-8 by default. You can change the encoding of your current session by running `chcp 65001` before entering IEx.
Copy file name to clipboardExpand all lines: getting-started/binaries-strings-and-char-lists.markdown
+2-2
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ iex> String.length string
38
38
5
39
39
```
40
40
41
-
> Note: if you are running on Windows, there is a chance your terminal does not use UTF-8 by default. You can change the encoding of your current session by running `chcp 65001` before entering iex.
41
+
> Note: if you are running on Windows, there is a chance your terminal does not use UTF-8 by default. You can change the encoding of your current session by running `chcp 65001` before entering `iex`.
42
42
43
43
UTF-8 requires one byte to represent the code points `h`, `e` and `o`, but two bytes to represent `ł`. In Elixir, you can get a code point's value by using `?`:
44
44
@@ -168,7 +168,7 @@ iex> 'hello'
168
168
'hello'
169
169
```
170
170
171
-
You can see that, instead of containing bytes, a char list contains the code points of the characters between single-quotes (note that iex will only output code points if any of the chars is outside the ASCII range). So while double-quotes represent a string (i.e. a binary), single-quotes represents a char list (i.e. a list).
171
+
You can see that, instead of containing bytes, a char list contains the code points of the characters between single-quotes (note that IEx will only output code points if any of the chars is outside the ASCII range). So while double-quotes represent a string (i.e. a binary), single-quotes represents a char list (i.e. a list).
172
172
173
173
In practice, char lists are used mostly when interfacing with Erlang, in particular old libraries that do not accept binaries as arguments. You can convert a char list to a string and back by using the `to_string/1` and `to_char_list/1` functions:
Copy file name to clipboardExpand all lines: getting-started/introduction.markdown
+1-1
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ When you install Elixir, you will have three new executables: `iex`, `elixir` an
31
31
32
32
For now, let's start by running `iex` (or `iex.bat` if you are on Windows) which stands for Interactive Elixir. In interactive mode, we can type any Elixir expression and get its result. Let's warm up with some basic expressions.
33
33
34
-
Open up `iex`and type the following expressions:
34
+
Open up `iex` and type the following expressions:
35
35
36
36
```iex
37
37
Interactive Elixir - press Ctrl+C to exit (type h() ENTER for help)
Copy file name to clipboardExpand all lines: getting-started/meta/macros.markdown
+1-1
Original file line number
Diff line number
Diff line change
@@ -227,7 +227,7 @@ Elixir also supports private macros via `defmacrop`. As private functions, these
227
227
228
228
It is important that a macro is defined before its usage. Failing to define a macro before its invocation will raise an error at runtime, since the macro won't be expanded and will be translated to a function call:
Copy file name to clipboardExpand all lines: getting-started/mix-otp/dependencies-and-umbrella-apps.markdown
+2-2
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ def deps do
46
46
end
47
47
```
48
48
49
-
This dependency refers to the latest version of plug in the 0.5.x version series that has been pushed to Hex. This is indicated by the `~>` preceding the version number. For more information on specifying version requirements, see the [documentation for the Version module](/docs/stable/elixir/#!Version.html).
49
+
This dependency refers to the latest version of Plug in the 0.5.x version series that has been pushed to Hex. This is indicated by the `~>` preceding the version number. For more information on specifying version requirements, see the [documentation for the Version module](/docs/stable/elixir/#!Version.html).
50
50
51
51
Typically, stable releases are pushed to Hex. If you want to depend on an external dependency still in development, Mix is able to manage git dependencies, too:
52
52
@@ -94,7 +94,7 @@ However, if you push every application as a separate project to a git repository
94
94
95
95
For this reason, Mix supports "umbrella projects." Umbrella projects allow you to create one project that hosts many applications and push all of them to a single git repository. That is exactly the style we are going to explore in the next sections.
96
96
97
-
What we are going to do is create a new mix project. We are going to creatively name it `kv_umbrella`, and this new project will have both the existing `kv` application and the new `kv_server` application inside. The directory structure will look like this:
97
+
What we are going to do is create a new Mix project. We are going to creatively name it `kv_umbrella`, and this new project will have both the existing `kv` application and the new `kv_server` application inside. The directory structure will look like this:
Copy file name to clipboardExpand all lines: getting-started/mix-otp/introduction-to-mix.markdown
+4-4
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ In this chapter, we will create our first project using Mix and explore differen
48
48
49
49
When you install Elixir, besides getting the `elixir`, `elixirc` and `iex` executables, you also get an executable Elixir script named `mix`.
50
50
51
-
Let's create our first project by invoking `mix new` from the command line. We'll pass the project name as argument (`kv`, in this case), and tell mix that our main module should be the all-uppercase `KV`, instead of the default, which would have been `Kv`:
51
+
Let's create our first project by invoking `mix new` from the command line. We'll pass the project name as argument (`kv`, in this case), and tell Mix that our main module should be the all-uppercase `KV`, instead of the default, which would have been `Kv`:
52
52
53
53
```bash
54
54
$ mix new kv --module KV
@@ -69,7 +69,7 @@ Mix will create a directory named `kv` with a few files in it:
69
69
70
70
Let's take a brief look at those generated files.
71
71
72
-
> Note: Mix is an Elixir executable. This means that in order to run `mix`, you need to have elixir's executable in your PATH. If not, you can run it by passing the script as argument to elixir:
72
+
> Note: Mix is an Elixir executable. This means that in order to run `mix`, you need to have Elixir's executable in your PATH. If not, you can run it by passing the script as argument to `elixir`:
73
73
>
74
74
> ```bash
75
75
> $ bin/elixir bin/mix new kv --module KV
@@ -81,7 +81,7 @@ Let's take a brief look at those generated files.
81
81
> $ bin/elixir -S mix new kv --module KV
82
82
>```
83
83
>
84
-
> When using -S, elixir finds the script wherever it is in your PATH and executes it.
84
+
> When using -S, `elixir` finds the script wherever it is in your PATH and executes it.
85
85
86
86
## Project compilation
87
87
@@ -215,7 +215,7 @@ Finally, the stacktrace relates to the failure itself, giving information about
215
215
216
216
Mix supports the concept of "environments". They allow a developer to customize compilation and other options for specific scenarios. By default, Mix understands three environments:
217
217
218
-
*`:dev` - the one in which mix tasks (like `compile`) run by default
218
+
*`:dev` - the one in which Mix tasks (like `compile`) run by default
219
219
*`:test` - used by `mix test`
220
220
*`:prod` - the one you will use to put your project in production
Now we get an error because an application that `:kv` depends on (`:logger` in this case) isn't started. We need to either start each application manually in the correct order or call `Application.ensure_all_started` as follows:
131
131
132
-
```elixir
132
+
```iex
133
133
iex> Application.ensure_all_started(:kv)
134
134
{:ok, [:logger, :kv]}
135
135
```
136
136
137
137
Nothing really exciting happens but it shows how we can control our application.
138
138
139
-
> When you run `iex -S mix`, it is equivalent to running `iex -S mix run`. So whenever you need to pass more options to Mix when starting iex, it's just a matter of typing `iex -S mix run` and then passing any options the `run` command accepts. You can find more information about `run` by running `mix help run` in your shell.
139
+
> When you run `iex -S mix`, it is equivalent to running `iex -S mix run`. So whenever you need to pass more options to Mix when starting IEx, it's just a matter of typing `iex -S mix run` and then passing any options the `run` command accepts. You can find more information about `run` by running `mix help run` in your shell.
Copy file name to clipboardExpand all lines: getting-started/sigils.markdown
+1-1
Original file line number
Diff line number
Diff line change
@@ -96,7 +96,7 @@ iex> ~w(foo bar bat)a
96
96
97
97
Besides lowercase sigils, Elixir supports uppercase sigils to deal with escaping characters and interpolation. While both `~s` and `~S` will return strings, the former allows escape codes and interpolation while the latter does not:
98
98
99
-
```elixir
99
+
```iex
100
100
iex> ~s(String with escape codes \x26 #{"inter" <> "polation"})
101
101
"String with escape codes & interpolation"
102
102
iex> ~S(String without escape codes and without #{interpolation})
0 commit comments