@@ -25,11 +25,11 @@ Erlang provides a number of data types, which are listed in this section.
2525
2626[ ] ( ) {: #no_user_types }
2727
28- Note that Erlang has no user defined types, only composite types (data
28+ Note that Erlang has no user- defined types, only composite types (data
2929structures) made of Erlang terms. This means that any function testing for a
3030composite type, typically named ` is_type/1 ` , might return ` true ` for a term that
31- coincides with the chosen representation. The corresponding functions for built
32- in types do not suffer from this.
31+ coincides with the chosen representation. The corresponding functions for built-in
32+ types do not suffer from this.
3333
3434## Terms
3535
@@ -38,26 +38,26 @@ A piece of data of any data type is called a _term_.
3838## Number
3939
4040There are two types of numeric literals, _ integers_ and _ floats_ . Besides the
41- conventional notation, there are two Erlang-specific notations:
41+ conventional notation, there are three Erlang-specific notations:
4242
4343- ` $ ` _ ` char ` _
44- ASCII value or unicode code-point of the character _ ` char ` _ .
44+ ASCII value or Unicode code-point of the character _ ` char ` _ .
4545- _ ` base ` _ ` # ` _ ` digits ` _
4646 Integer with the base _ ` base ` _ , which must be an integer in the range 2
47- through 36. _ ` digits ` _ are ` 0 ` -` 9 ` plus letters ` A ` -` Z ` (upper or lower case ).
47+ through 36. _ ` digits ` _ are ` 0 ` -` 9 ` plus letters ` A ` -` Z ` (upper- or lowercase ).
4848 This notation can also be found in the Ada programming
4949 language. Erlang does _ not_ support prefixes such as ` 0x ` for hexadecimal
5050 or ` 077 ` for octal.
5151- _ ` base ` _ ` # ` _ ` digits ` _ ` . ` _ ` digits ` _ ` #e ` _ ` exponent ` _
52- Based floating point number, for example ` 16#ff.fe#e+6 ` . Using a base
53- like 16 or 2 allows for an exact text representation of a floating
54- point number. Like the base, the exponent is always a decimal number.
52+ Based floating- point number, for example ` 16#ff.fe#e+6 ` . Using a base
53+ like 16 or 2 allows for an exact text representation of a floating-point
54+ number. Like the base, the exponent is always a decimal number.
5555
5656
5757Leading zeroes are ignored. Single underscore characters (` _ ` ) can be
5858inserted between digits as a visual separator.
5959
60- Also note that floating point numbers must start with a digit, and must
60+ Also note that floating- point numbers must start with a digit, and must
6161contain a ` . ` . In other words, literals such as ` .01 ` and ` 1e6 ` are not
6262allowed, and must be written ` 0.01 ` and ` 1.0e6 ` respectively.
6363
@@ -99,7 +99,7 @@ than `2.4`, `3` compares greater than `2.99999`, and `5` is equal to `5.0`.
9999
100100When wanting to compare an integer with another integer or a float with another
101101float, it may be tempting to use the term equivalence operators (` =:= ` , ` =/= ` )
102- or pattern matching. This works for integers which has a distinct representation
102+ or pattern matching. This works for integers which have a distinct representation
103103for every number, but there's a surprising edge case for floating-point as the
104104latter has two representations for zero which are considered different by the
105105term equivalence operators and pattern matching.
@@ -137,9 +137,9 @@ false
137137true
138138```
139139
140- ### Representation of Floating Point Numbers
140+ ### Representation of Floating- Point Numbers
141141
142- When working with floats you may not see what you expect when printing or doing
142+ When working with floats, you may not see what you expect when printing or doing
143143arithmetic operations. This is because floats are represented by a fixed number
144144of bits in a base-2 system while printed floats are represented with a base-10
145145system. Erlang uses 64-bit floats. Here are examples of this phenomenon:
@@ -164,7 +164,7 @@ Erlang's pretty printer rounds `36028797018963968.0` to `3.602879701896397e16`
164164` [36028797018963966.0, 36028797018963972.0] ` are represented by
165165` 36028797018963968.0 ` .
166166
167- For more information about floats and issues with them see:
167+ For more information about floats and issues with them, see:
168168
169169- [ What Every Programmer Should Know About Floating-Point Arithmetic] ( https://floating-point-gui.de/ )
170170- [ 0\. 30000000000000004.com/] ( https://0.30000000000000004.com/ )
@@ -194,9 +194,9 @@ _Examples_:
194194
195195## Atom
196196
197- An atom is a literal, a constant with name. An atom is to be enclosed in single
198- quotes (` ' ` ) if it does not begin with a lower-case letter or if it contains other
199- characters than alphanumeric characters, underscore (` _ ` ), or ` @ ` .
197+ An atom is a literal, a constant with a name. An atom is to be enclosed in single
198+ quotes (` ' ` ) if it does not begin with a lowercase letter or if it contains
199+ characters other than alphanumeric characters, underscore (` _ ` ), or ` @ ` .
200200
201201_ Examples:_
202202
266266## Fun
267267
268268A fun is a functional object. Funs make it possible to create an anonymous
269- function and pass the function itself — not its name — as argument to other
269+ function and pass the function itself — not its name — as an argument to other
270270functions.
271271
272272_ Examples:_
@@ -279,7 +279,7 @@ _Examples:_
279279```
280280
281281The [ ` is_function/1 ` ] ( `erlang:is_function/1` ) and [ ` is_function/2 ` ] ( `erlang:is_function/2` )
282- BIFs tests whether a term is a fun.
282+ BIFs test whether a term is a fun.
283283
284284_ Examples_ :
285285
@@ -319,7 +319,7 @@ The BIF [`self/0`](`erlang:self/0`) returns the Pid of the calling process. When
319319process will be able to get the Pid of the child process either via the return
320320value, as is the case when calling the [ ` spawn/3 ` ] ( `erlang:spawn/3` ) BIF, or via
321321a message, which is the case when calling the
322- [ ` spawn_request/5 ` ] ( `erlang:spawn_request/5` ) BIF. A Pid is typically used when
322+ [ ` spawn_request/5 ` ] ( `erlang:spawn_request/5` ) BIF. A Pid is typically used
323323when sending a process a [ signal] ( ref_man_processes.md#signals ) . The
324324[ ` is_pid/1 ` ] ( `erlang:is_pid/1` ) BIF tests whether a term is a Pid.
325325
@@ -356,7 +356,7 @@ A tuple is a compound data type with a fixed number of terms:
356356Each term ` Term ` in the tuple is called an _ element_ . The number of elements is
357357said to be the _ size_ of the tuple.
358358
359- There exists a number of BIFs to manipulate tuples.
359+ There are a number of BIFs to manipulate tuples.
360360
361361_ Examples:_
362362
@@ -389,7 +389,7 @@ Each key-value association in the map is called an _association pair_. The key
389389and value parts of the pair are called _ elements_ . The number of association
390390pairs is said to be the _ size_ of the map.
391391
392- There exists a number of BIFs to manipulate maps.
392+ There are a number of BIFs to manipulate maps.
393393
394394_ Examples:_
395395
@@ -402,13 +402,13 @@ adam
402402{july ,29 }
4034034 > M2 = maps :update (age , 25 , M1 ).
404404#{age => 25 ,date => {july ,29 },name => adam }
405- 5 > map_size (M ).
405+ 5 > map_size (M1 ).
4064063
4074076 > map_size (#{}).
4084080
409409```
410410
411- A collection of maps processing functions are found in module ` m:maps `
411+ A collection of map- processing functions can be found in the module ` m:maps `
412412in STDLIB.
413413
414414Read more about maps in [ Map Expressions] ( expressions.md#map-expressions ) .
@@ -432,7 +432,7 @@ said to be the _length_ of the list.
432432Formally, a list is either the empty list ` [] ` or consists of a _ head_ (first
433433element) and a _ tail_ (remainder of the list). The _ tail_ is also a list. The
434434latter can be expressed as ` [H|T] ` . The notation ` [Term1,...,TermN] ` above is
435- equivalent with the list ` [Term1|[...|[TermN|[]]]] ` .
435+ equivalent to the list ` [Term1|[...|[TermN|[]]]] ` .
436436
437437_ Example:_
438438
4644640
465465```
466466
467- A collection of list processing functions are found in module
467+ A collection of list- processing functions can be found in the module
468468` m:lists ` in STDLIB.
469469
470470## String
471471
472- Strings are enclosed in double quotes ("), but is not a data type in Erlang.
472+ Strings are enclosed in double quotes ("), but are not a data type in Erlang.
473473Instead, a string ` "hello" ` is shorthand for the list ` [$h,$e,$l,$l,$o] ` , that
474474is, ` [104,101,108,108,111] ` .
475475
476- Two adjacent string literals are concatenated into one. This is done in the
476+ Two adjacent string literals are concatenated into one. This is done during
477477compilation.
478478
479479_ Example:_
@@ -490,7 +490,7 @@ is equivalent to
490490
491491> #### Change {: .info }
492492>
493- > Starting with Erlang/OTP 27 two adjacent string literals have to be separated
493+ > Starting with Erlang/OTP 27, two adjacent string literals have to be separated
494494> by white space, or otherwise it is a syntax error. This avoids possible confusion
495495> with _ triple-quoted strings_ .
496496
@@ -501,11 +501,11 @@ sequences, and thereby do not need double quote characters to be escaped.
501501
502502> #### Change {: .info }
503503>
504- > Triple-quoted strings were added in Erlang/OTP 27. Before that 3 consecutive
505- > double quote characters had a different meaning. There were absolutely no good
504+ > Triple-quoted strings were added in Erlang/OTP 27. Before that, 3 consecutive
505+ > double quote characters had a different meaning. There was absolutely no good
506506> reason to write such a character sequence before triple-quoted strings
507507> existed, but there _ are_ some gotchas; see the
508- > [ Warning ] ( data_types.md#triple-quoted-strings-warning ) at the end of this
508+ > [ Warning] ( data_types.md#triple-quoted-strings-warning ) at the end of this
509509> description of triple-quoted strings.
510510
511511Example, with verbatim double quote characters:
@@ -517,15 +517,15 @@ Example, with verbatim double quote characters:
517517 """
518518```
519519
520- That is equivalent to the normal single quoted string (which also allows
520+ That is equivalent to a normal single- quoted string (which also allows
521521newlines):
522522
523523``` text
524524"Line \"1\"
525525Line \"2\""
526526```
527527
528- The opening and the closing line has got the delimiters: the ` """ ` characters.
528+ The opening and closing lines contain the delimiters, the ` """ ` characters.
529529The lines between them are the content lines. The newline on the opening line is
530530not regarded as string content, nor is the newline on the last content line.
531531
@@ -601,7 +601,7 @@ These strings are all the empty string:
601601> strings.
602602>
603603> The compiler preprocessor was patched in Erlang/OTP 26.1 to warn about 3 or
604- > more sequential double quote characters. In Erlang/OTP 26.2 this was improved
604+ > more sequential double quote characters. In Erlang/OTP 26.2, this was improved
605605> to warn about adjacent string literals without intervening white space, which
606606> also covers the same problem at a string end.
607607>
@@ -618,7 +618,7 @@ offer mainly two things: a compact way to create UTF-8 encoded binary strings,
618618and a way to write verbatim strings (not having to escape ` \ ` characters),
619619useful for regular expressions, for example.
620620
621- A sigil starts with the Tilde character (` ~ ` ) followed by a name defining the
621+ A sigil starts with the tilde character (` ~ ` ) followed by a name defining the
622622sigil type.
623623
624624Immediately after follows the sigil content; a character sequence between
@@ -627,19 +627,19 @@ content delimiters. The allowed delimiters are these start-end delimiter pairs:
627627`` / | ' " ` # `` . [ Triple-quote] ( data_types.md#tqstring ) string delimiters may
628628also be used.
629629
630- The [ character escaping rules ] ( data_types.md#escape-sequences ) for the sigil
631- content depends on the sigil type. When the sigil content is _ verbatim_ , there
630+ The [ character escaping rules] ( data_types.md#escape-sequences ) for the sigil
631+ content depend on the sigil type. When the sigil content is _ verbatim_ , there
632632is no escape character. The sigil content simply ends when the end delimiter is
633633found, so it is impossible to have the end delimiter character in the string
634634content. The set of delimiters is fairly generous, and in most cases it is
635635possible to choose an end delimiter that's not in the literal string content.
636636
637637[ Triple-quote] ( data_types.md#tqstring ) string delimiters allow choosing a larger
638- number of quote characters in the end delimiter, than whatever is in the string
638+ number of quote characters in the end delimiter than whatever is in the string
639639content, which thereby facilitates any content also with a sequence of ` " `
640640characters at the start of a line even for a _ verbatim_ string.
641641
642- The Sigils are:
642+ The sigils are:
643643
644644- ** ` ~ ` ** - The Vanilla (default) Sigil. Shorthand for a UTF-8 encoded
645645 ` t:binary/0 ` . This sigil does not affect the character escaping rules, so with
@@ -648,7 +648,7 @@ The Sigils are:
648648
649649- ** ` ~b ` ** - The Binary Sigil. Shorthand for a
650650 [ UTF-8 encoded ` binary() ` ] ( `t:unicode:unicode_binary/0` ) , as if calling
651- [ ` unicode:characters_to_binary/1 ` ] ( `unicode:characters_to_binary/1` ) on the
651+ [ ` unicode:characters_to_binary/1 ` ] ( `unicode:characters_to_binary/1` ) on the
652652 sigil content. Character escaping rules are the same as for ` ~s ` .
653653
654654- ** ` ~B ` ** - The Verbatim Binary Sigil. As ` ~b ` , but the sigil content is
@@ -657,7 +657,7 @@ The Sigils are:
657657- ** ` ~s ` ** - The String Sigil. Shorthand for a
658658 [ ` string() ` ] ( `t:erlang:string/0` ) , that is, a ` [char()] ` which is a list of
659659 Unicode codepoints.
660- [ Character escaping rules ] ( data_types.md#escape-sequences ) are the same as for
660+ [ Character escaping rules] ( data_types.md#escape-sequences ) are the same as for
661661 a normal ` t:string/0 ` . Using this sigil on a regular string does effectively
662662 nothing.
663663
@@ -692,15 +692,15 @@ Examples
692692 """ = "\"\\µA\""
693693```
694694
695- Adjacent strings are concatenated in the compilation, but that is not possible
695+ Adjacent strings are concatenated during compilation, but that is not possible
696696with sigils, since they are transformed into terms that in general may not be
697697concatenated. So, ` "a" "b" ` is equivalent to ` "ab" ` , but ` ~s"a" "b" ` or
698698` ~s"a" ~s"b" ` is a syntax error. ` ~s"a" ++ "b" ` , however, evaluates to ` "ab" `
699699since both operands to the ` ++ ` operator are strings.
700700
701701> #### Change {: .info }
702702>
703- > Sigils were introduced in Erlang/OTP 27
703+ > Sigils were introduced in Erlang/OTP 27.
704704
705705## Record
706706
@@ -770,7 +770,7 @@ false
770770
771771## Boolean
772772
773- There is no Boolean data type in Erlang. Instead the atoms ` true ` and ` false `
773+ There is no Boolean data type in Erlang. Instead, the atoms ` true ` and ` false `
774774are used to denote Boolean values. The [ ` is_boolean/1 ` ] ( `erlang:is_boolean/1` )
775775BIF tests whether a term is a boolean.
776776
@@ -838,8 +838,8 @@ or above is allowed for the start delimiter and the end delimiter is the same as
838838the start delimiter.
839839
840840When triple-quote string delimiters are used with the
841- [ ` ~ ` , ` ~B ` or ` ~S ` sigils ] ( data_types.md#sigil ) the same applies, but for the
842- [ ` ~b ` or ` ~s ` sigils ] ( data_types.md#sigil ) the escape sequences for normal
841+ [ ` ~ ` , ` ~B ` or ` ~S ` sigils] ( data_types.md#sigil ) the same applies, but for the
842+ [ ` ~b ` or ` ~s ` sigils] ( data_types.md#sigil ) the escape sequences for normal
843843strings, above, are used.
844844
845845> #### Change {: .info }
0 commit comments