summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorVarriount <Varriount@users.noreply.github.com>2014-07-27 22:21:38 -0400
committerVarriount <Varriount@users.noreply.github.com>2014-07-27 22:21:38 -0400
commit6debe48b2325afb4174d27fe5f8acf5ff0c7ab01 (patch)
treebbaa723ec51d0130856707fb56a96310c4ed7340 /doc
parent83d7d30af40a2cf4b1915cce51c8f8b4bdf4f8c5 (diff)
parente9417b55cfea809638de7f09865115e3ec6907c9 (diff)
downloadNim-6debe48b2325afb4174d27fe5f8acf5ff0c7ab01.tar.gz
Merge pull request #1414 from gradha/pr_sets_improvements
Sets improvements
Diffstat (limited to 'doc')
-rw-r--r--doc/manual.txt32
-rw-r--r--doc/sets_fragment.txt40
-rw-r--r--doc/tut1.txt41
3 files changed, 42 insertions, 71 deletions
diff --git a/doc/manual.txt b/doc/manual.txt
index 54c1477e8..53700ae80 100644
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -1221,38 +1221,8 @@ branch switch ``system.reset`` has to be used.
 
 Set type
 --------
-The set type models the mathematical notion of a set. The set's
-basetype can only be an ordinal type. The reason is that sets are implemented
-as high performance bit vectors.
-
-Sets can be constructed via the set constructor: ``{}`` is the empty set. The
-empty set is type compatible with any special set type. The constructor
-can also be used to include elements (and ranges of elements) in the set:
-
-.. code-block:: nimrod
-
-  {'a'..'z', '0'..'9'} # This constructs a set that contains the
-                       # letters from 'a' to 'z' and the digits
-                       # from '0' to '9'
-
-These operations are supported by sets:
-
-==================    ========================================================
-operation             meaning
-==================    ========================================================
-``A + B``             union of two sets
-``A * B``             intersection of two sets
-``A - B``             difference of two sets (A without B's elements)
-``A == B``            set equality
-``A <= B``            subset relation (A is subset of B or equal to B)
-``A < B``             strong subset relation (A is a real subset of B)
-``e in A``            set membership (A contains element e)
-``A -+- B``           symmetric set difference (= (A - B) + (B - A))
-``card(A)``           the cardinality of A (number of elements in A)
-``incl(A, elem)``     same as A = A + {elem}
-``excl(A, elem)``     same as A = A - {elem}
-==================    ========================================================
 
+.. include:: sets_fragment.txt
 
 Reference and pointer types
 ---------------------------
diff --git a/doc/sets_fragment.txt b/doc/sets_fragment.txt
new file mode 100644
index 000000000..fba355269
--- /dev/null
+++ b/doc/sets_fragment.txt
@@ -0,0 +1,40 @@
+The set type models the mathematical notion of a set. The set's
+basetype can only be an ordinal type. The reason is that sets are implemented
+as high performance bit vectors.
+
+Sets can be constructed via the set constructor: ``{}`` is the empty set. The
+empty set is type compatible with any concrete set type. The constructor
+can also be used to include elements (and ranges of elements):
+
+.. code-block:: nimrod
+  type
+    TCharSet = set[char]
+  var
+    x: TCharSet
+  x = {'a'..'z', '0'..'9'} # This constructs a set that contains the
+                           # letters from 'a' to 'z' and the digits
+                           # from '0' to '9'
+
+These operations are supported by sets:
+
+==================    ========================================================
+operation             meaning
+==================    ========================================================
+``A + B``             union of two sets
+``A * B``             intersection of two sets
+``A - B``             difference of two sets (A without B's elements)
+``A == B``            set equality
+``A <= B``            subset relation (A is subset of B or equal to B)
+``A < B``             strong subset relation (A is a real subset of B)
+``e in A``            set membership (A contains element e)
+``e notin A``         A does not contain element e
+``contains(A, e)``    A contains element e
+``A -+- B``           symmetric set difference (= (A - B) + (B - A))
+``card(A)``           the cardinality of A (number of elements in A)
+``incl(A, elem)``     same as ``A = A + {elem}``
+``excl(A, elem)``     same as ``A = A - {elem}``
+==================    ========================================================
+
+Sets are often used to define a type for the *flags* of a procedure. This is
+a much cleaner (and type safe) solution than just defining integer
+constants that should be ``or``'ed together.
diff --git a/doc/tut1.txt b/doc/tut1.txt
index a2aa835ee..55eb0ebd7 100644
--- a/doc/tut1.txt
+++ b/doc/tut1.txt
@@ -1117,47 +1117,8 @@ avoid this common programming error.
 
 Sets
 ----
-The set type models the mathematical notion of a set. The set's
-basetype can only be an ordinal type. The reason is that sets are implemented
-as high performance bit vectors.
-
-Sets can be constructed via the set constructor: ``{}`` is the empty set. The
-empty set is type compatible with any concrete set type. The constructor
-can also be used to include elements (and ranges of elements):
-
-.. code-block:: nimrod
-  type
-    TCharSet = set[char]
-  var
-    x: TCharSet
-  x = {'a'..'z', '0'..'9'} # This constructs a set that contains the
-                           # letters from 'a' to 'z' and the digits
-                           # from '0' to '9'
-
-These operations are supported by sets:
-
-==================    ========================================================
-operation             meaning
-==================    ========================================================
-``A + B``             union of two sets
-``A * B``             intersection of two sets
-``A - B``             difference of two sets (A without B's elements)
-``A == B``            set equality
-``A <= B``            subset relation (A is subset of B or equal to B)
-``A < B``             strong subset relation (A is a real subset of B)
-``e in A``            set membership (A contains element e)
-``e notin A``         A does not contain element e
-``contains(A, e)``    A contains element e
-``A -+- B``           symmetric set difference (= (A - B) + (B - A))
-``card(A)``           the cardinality of A (number of elements in A)
-``incl(A, elem)``     same as ``A = A + {elem}``
-``excl(A, elem)``     same as ``A = A - {elem}``
-==================    ========================================================
-
-Sets are often used to define a type for the *flags* of a procedure. This is
-a much cleaner (and type safe) solution than just defining integer
-constants that should be ``or``'ed together.
 
+.. include:: sets_fragment.txt
 
 Arrays
 ------