summary refs log tree commit diff stats
path: root/lib/std/setutils.nim
diff options
context:
space:
mode:
authorkonsumlamm <44230978+konsumlamm@users.noreply.github.com>2021-01-22 13:13:18 +0100
committerGitHub <noreply@github.com>2021-01-22 13:13:18 +0100
commit72bbd07ec14f9879e0da85e2f57eae38b0d9e162 (patch)
tree18f80ca24ca3d450862b499c99088196381f2a17 /lib/std/setutils.nim
parentf1d165adf2f36e483777258a9618a8b540c24017 (diff)
downloadNim-72bbd07ec14f9879e0da85e2f57eae38b0d9e162.tar.gz
Add std/setutils to lib.rst (#16791)
* Add std/setutils to lib.rst

Improve doc comments for setutils

* Adhere to the RST spec

Use no UFCS in toSet
Diffstat (limited to 'lib/std/setutils.nim')
-rw-r--r--lib/std/setutils.nim15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/std/setutils.nim b/lib/std/setutils.nim
index c6385180e..215c7a76a 100644
--- a/lib/std/setutils.nim
+++ b/lib/std/setutils.nim
@@ -7,10 +7,14 @@
 #    distribution, for details about the copyright.
 #
 
-## This module adds functionality to the built-in `set` type.
-## See also std/packedsets, std/sets
+## This module adds functionality for the built-in `set` type.
+##
+## See also
+## ========
+## * `std/packedsets <packedsets.html>`_
+## * `std/sets <sets.html>`_
 
-import typetraits
+import std/typetraits
 
 #[
   type SetElement* = char|byte|bool|int16|uint16|enum|uint8|int8
@@ -18,14 +22,15 @@ import typetraits
 ]#
 
 template toSet*(iter: untyped): untyped =
-  ## Return a built-in set from the elements of iterable `iter`
-  runnableExamples: 
+  ## Returns a built-in set from the elements of the iterable `iter`.
+  runnableExamples:
     assert "helloWorld".toSet == {'W', 'd', 'e', 'h', 'l', 'o', 'r'}
     assert toSet([10u16, 20, 30]) == {10u16, 20, 30}
     assert [30u8, 100, 10].toSet == {10u8, 30, 100}
     assert toSet(@[1321i16, 321, 90]) == {90i16, 321, 1321}
     assert toSet([false]) == {false}
     assert toSet(0u8..10) == {0u8..10}
+
   var result: set[elementType(iter)]
   for x in iter:
     incl(result, x)