summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorJuan Carlos <juancarlospaco@gmail.com>2019-07-06 04:45:48 -0300
committerAndreas Rumpf <rumpf_a@web.de>2019-07-06 09:45:48 +0200
commit25cd8a5490e94d79eaafaaa19f198d0771d9b40c (patch)
treef99b38efb2c3ecb102b0862eb512b263a629a260 /lib
parent34c09a98c7ffc5210861a9d67add681b16049c40 (diff)
downloadNim-25cd8a5490e94d79eaafaaa19f198d0771d9b40c.tar.gz
Documentation Diff, Typo (#11566)
* Documentation for Diff, add Examples and runnableExamples

Diffstat (limited to 'lib')
-rw-r--r--lib/experimental/diff.nim24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/experimental/diff.nim b/lib/experimental/diff.nim
index 253355707..9046d7316 100644
--- a/lib/experimental/diff.nim
+++ b/lib/experimental/diff.nim
@@ -9,6 +9,28 @@
 
 ## This module implements an algorithm to compute the
 ## `diff`:idx: between two sequences of lines.
+##
+## A basic example of ``diffInt`` on 2 arrays of integers:
+##
+## .. code::nim
+##
+##   import experimental/diff
+##   echo diffInt([0, 1, 2, 3, 4, 5, 6, 7, 8], [-1, 1, 2, 3, 4, 5, 666, 7, 42])
+##
+## Another short example of ``diffText`` to diff strings:
+##
+## .. code::nim
+##
+##   import experimental/diff
+##   # 2 samples of text for testing (from "The Call of Cthulhu" by Lovecraft)
+##   let txt0 = """I have looked upon all the universe has to hold of horror,
+##   even skies of spring and flowers of summer must ever be poison to me."""
+##   let txt1 = """I have looked upon all your code has to hold of bugs,
+##   even skies of spring and flowers of summer must ever be poison to me."""
+##
+##   echo diffText(txt0, txt1)
+##
+## - To learn more see `Diff on Wikipedia. <http://wikipedia.org/wiki/Diff>`_
 
 # code owner: Arne Döring
 #
@@ -257,7 +279,7 @@ proc diffInt*(arrayA, arrayB: openArray[int]): seq[Item] =
   ##
   ## ``arrayB`` B-version of the numbers (usualy the new one)
   ##
-  ## Returns a array of Items that describe the differences.
+  ## Returns a sequence of Items that describe the differences.
 
   # The A-Version of the data (original data) to be compared.
   var dataA = newDiffData(@arrayA, arrayA.len)