diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2014-07-15 01:42:19 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2014-07-15 01:42:19 +0200 |
commit | 18ded6c23d72cd21fa0aa10ff61dc6f9af40832c (patch) | |
tree | 5d681c9835f01019e8ae83e14c0cd49d1a6c0d38 /lib/pure/algorithm.nim | |
parent | 687a1b7de4c006750274fb046a10f08d38c22f5a (diff) | |
parent | 41bb0bf9dcccdfcebdb0f823fea8b2853b89ea4e (diff) | |
download | Nim-18ded6c23d72cd21fa0aa10ff61dc6f9af40832c.tar.gz |
Merge pull request #1363 from Araq/devel
Merge devel into master
Diffstat (limited to 'lib/pure/algorithm.nim')
-rw-r--r-- | lib/pure/algorithm.nim | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/pure/algorithm.nim b/lib/pure/algorithm.nim index 37fbc948c..86d329763 100644 --- a/lib/pure/algorithm.nim +++ b/lib/pure/algorithm.nim @@ -150,6 +150,15 @@ proc sort*[T](a: var openArray[T], ## # overload: ## sort(myStrArray, system.cmp) ## + ## You can inline adhoc comparison procs with the `do notation + ## <manual.html#do-notation>`_. Example: + ## + ## .. code-block:: nimrod + ## + ## people.sort do (x, y: Person) -> int: + ## result = cmp(x.surname, y.surname) + ## if result == 0: + ## result = cmp(x.name, y.name) var n = a.len var b: seq[T] newSeq(b, n div 2) |