Skip to content

Commit 209c88a

Browse files
author
José Valim
committed
Merge pull request #1397 from jwarwick/typos
Fixed doc typos in Kernel and Record
2 parents 2dc1e41 + 3c3cf14 commit 209c88a

File tree

2 files changed

+27
-33
lines changed

2 files changed

+27
-33
lines changed

lib/elixir/lib/kernel.ex

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,16 +1272,16 @@ defmodule Kernel do
12721272
12731273
## Nesting
12741274
1275-
Nesting a module inside the other affects its name:
1275+
Nesting a module inside another module affects its name:
12761276
12771277
defmodule Foo do
12781278
defmodule Bar do
12791279
end
12801280
end
12811281
1282-
In the example above, two modules `Foo` and `Foo.Bar`. The
1282+
In the example above, two modules `Foo` and `Foo.Bar` are created. The
12831283
second can be accessed as `Bar` inside `Foo` in the same
1284-
lexical scope. If the module Bar is moved away to another
1284+
lexical scope. If the module `Bar` is moved to another
12851285
file, it needs to be referenced via the full name or an
12861286
alias need to be set with the help of `Kernel.SpecialForms.alias/2`.
12871287
@@ -1360,7 +1360,7 @@ defmodule Kernel do
13601360

13611361
@doc """
13621362
Defines a function that is private. Private functions are
1363-
only accessible from the same module in which they are defined.
1363+
only accessible from within the module in which they are defined.
13641364
13651365
Check `def/2` for more information
13661366
@@ -1599,14 +1599,14 @@ defmodule Kernel do
15991599
name #=> "José"
16001600
16011601
By default, Elixir uses the record name as the first element of the tuple.
1602-
In some cases though, this might be undesirable and one can explicitly
1602+
In some cases though, this might be undesirable and one can explicitly
16031603
define what the first element of the record should be:
16041604
16051605
defmodule MyServer do
16061606
defrecordp :state, MyServer, data: nil
16071607
end
16081608
1609-
This way, the record created will have `MyServer` as first element,
1609+
This way, the record created will have `MyServer` as the first element,
16101610
not `:state`:
16111611
16121612
state() #=> { MyServer, nil }
@@ -1671,10 +1671,9 @@ defmodule Kernel do
16711671
end
16721672

16731673
@doc """
1674-
Define elem to get Tuple element according to Elixir conventions
1675-
(i.e. it expects the tuple as first argument, zero-index based).
1674+
Get the element at the zero-based `index` in `tuple`.
16761675
1677-
It is implemented as a macro so it can be used in guards.
1676+
Implemented as a macro so it can be used in guards.
16781677
16791678
## Example
16801679
@@ -1692,8 +1691,7 @@ defmodule Kernel do
16921691
end
16931692

16941693
@doc """
1695-
Define set_elem to set Tuple element according to Elixir conventions
1696-
(i.e. it expects the tuple as first argument, zero-index based).
1694+
Sets the element in `tuple` at the zero-based `index` to the given `value`.
16971695
16981696
## Example
16991697
@@ -1711,9 +1709,7 @@ defmodule Kernel do
17111709
end
17121710

17131711
@doc """
1714-
Define insert_elem to insert element into a tuple according to
1715-
Elixir conventions (i.e. it expects the tuple as first argument,
1716-
zero-index based).
1712+
Inserts `value` into `tuple` at the given zero-based `index`.
17171713
17181714
## Example
17191715
@@ -1730,9 +1726,7 @@ defmodule Kernel do
17301726
end
17311727

17321728
@doc """
1733-
Define delete_elem to delete element from a tuple according to
1734-
Elixir conventions (i.e. it expects the tuple as first argument,
1735-
zero-index based).
1729+
Deletes the element at the zero-based `index` from `tuple`.
17361730
17371731
Please note that in versions of Erlang prior to R16B there is no BIF
17381732
for this operation and it is emulated by converting the tuple to a list
@@ -2737,24 +2731,24 @@ defmodule Kernel do
27372731
27382732
if(foo, do: bar)
27392733
2740-
In the example above, bar will be returned if foo evaluates to
2741-
true (i.e. it is not false nor nil). Otherwise, nil will be returned.
2734+
In the example above, `bar` will be returned if `foo` evaluates to
2735+
`true` (i.e. it is neither `false` nor `nil`). Otherwise, `nil` will be returned.
27422736
2743-
An else option can be given to specify the opposite:
2737+
An `else` option can be given to specify the opposite:
27442738
27452739
if(foo, do: bar, else: baz)
27462740
27472741
## Blocks examples
27482742
2749-
Elixir also allows you to pass a block to the if macro. The first
2743+
Elixir also allows you to pass a block to the `if` macro. The first
27502744
example above would be translated to:
27512745
27522746
if foo do
27532747
bar
27542748
end
27552749
2756-
Notice that do/end becomes delimiters. The second example would
2757-
then translate do:
2750+
Notice that `do/end` becomes delimiters. The second example would
2751+
then translate to:
27582752
27592753
if foo do
27602754
bar
@@ -3156,8 +3150,8 @@ defmodule Kernel do
31563150
end
31573151

31583152
@doc """
3159-
Returns true if the element on the left is equal (==) to
3160-
any of the items in the right.
3153+
Returns `true` if the element on the left is equal (==) to
3154+
any of the items on the right.
31613155
31623156
## Examples
31633157

lib/elixir/lib/record.ex

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ defmodule Record do
5757
user(sample_user, age: 26)
5858
5959
Since `user` is a macro, all the work happens at compilation time.
60-
This means all the operations, like changing the `age` above, works
60+
This means all operations, like changing the `age` above, work
6161
as a simple tuple operation at runtime:
6262
6363
# This update operation...
@@ -88,7 +88,7 @@ defmodule Record do
8888
defrecord User, name: "José", age: 25
8989
9090
Notice that, unlike `defrecordp`, `defrecord` expects an
91-
alias as first argument. This is because `defrecord` is going
91+
alias as the first argument. This is because `defrecord` is going
9292
to create a module named `User` with all the relevant metadata.
9393
This module can then be imported and we can manipulate the user
9494
as with `defrecordp`:
@@ -99,12 +99,12 @@ defmodule Record do
9999
100100
Notice that now, since the record definition is accessible, Elixir
101101
shows the record nicely formatted, no longer as a simple tuple. We
102-
can get the raw formatting with by passing raw: true to inspect:
102+
can get the raw formatting by passing `raw: true` to `inspect`:
103103
104104
inspect user(), raw: true
105105
{ User, "José", 25 }
106106
107-
Since working with external records is frequent, Elixir allows
107+
Since working with external records is common, Elixir allows
108108
developers to skip importing the record altogether in favor
109109
of a `Module[args]` syntax:
110110
@@ -199,11 +199,11 @@ defmodule Record do
199199
200200
## Example
201201
202-
defmodule Test do
203-
Record.import File.Stat, as: :file_stat
202+
defmodule Test do
203+
Record.import File.Stat, as: :file_stat
204204
205-
def size(file_stat(size: size)), do: size
206-
end
205+
def size(file_stat(size: size)), do: size
206+
end
207207
208208
"""
209209
defmacro import(module, as: name) do

0 commit comments

Comments
 (0)