]> gitweb.factorcode.org Git - factor.git/commitdiff
lcs: rename generic "diff" to lcs-diff
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 9 Jun 2015 00:16:42 +0000 (17:16 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 9 Jun 2015 00:16:42 +0000 (17:16 -0700)
basis/lcs/lcs-docs.factor
basis/lcs/lcs-tests.factor
basis/lcs/lcs.factor

index 4272b87c6c8209a1f72df191fe1768a85d94d477..ad81a7b3465dd8666d6d4abfa2e5efa51a8f06e7 100644 (file)
@@ -9,7 +9,7 @@ HELP: lcs
 { $values { "seq1" sequence } { "seq2" sequence } { "lcs" "a longest common subsequence" } }\r
 { $description "Given two sequences, calculates a longest common subsequence between them. Note two things: this is only one of the many possible LCSs, and the LCS may not be contiguous." } ;\r
 \r
-HELP: diff\r
+HELP: lcs-diff\r
 { $values { "old" sequence } { "new" sequence } { "diff" "an edit script" } }\r
 { $description "Given two sequences, find a minimal edit script from the old to the new. There may be more than one minimal edit script, and this chooses one arbitrarily. This script is in the form of an array of the tuples of the classes " { $link retain } ", " { $link delete } " and " { $link insert } " which have their information stored in the 'item' slot." } ;\r
 \r
@@ -26,10 +26,10 @@ ARTICLE: "lcs" "LCS, diffing and distance"
 "This vocabulary provides words for three apparently unrelated but in fact very similar problems: finding a longest common subsequence between two sequences, getting a minimal edit script (diff) between two sequences, and calculating the Levenshtein distance between two sequences. The implementations of these algorithms are very closely related, and all running times are O(nm), where n and m are the lengths of the input sequences."\r
 { $subsections\r
     lcs\r
-    diff\r
+    lcs-diff\r
     levenshtein\r
 }\r
-"The " { $link diff } " word returns a sequence of tuples of the following classes. They all hold their contents in the 'item' slot."\r
+"The " { $link lcs-diff } " word returns a sequence of tuples of the following classes. They all hold their contents in the 'item' slot."\r
 { $subsections\r
     insert\r
     delete\r
index 3aa10a0687493ff9ca9f883a716eb34f74ca998b..6b3871f4ff79628d5fdf589ccc33c69862e0006d 100644 (file)
@@ -22,4 +22,4 @@ USING: tools.test lcs ;
         T{ retain f CHAR: d }
         T{ insert f CHAR: e }
         T{ insert f CHAR: f }
-} ] [ "faxbcd" "abdef" diff ] unit-test
+} ] [ "faxbcd" "abdef" lcs-diff ] unit-test
index 930fc53a91b3608c7d1dfb196a7ccb80ab7813ba..e0ec97e6bd1d194abb494f82a43b3e341fa90e64 100644 (file)
@@ -99,8 +99,8 @@ TUPLE: trace-state old new table i j ;
 \r
 PRIVATE>\r
 \r
-: diff ( old new -- diff )\r
+: lcs-diff ( old new -- diff )\r
     2dup [ lcs-initialize ] [ lcs-step ] run-lcs trace-diff ;\r
 \r
 : lcs ( seq1 seq2 -- lcs )\r
-    [ diff [ retain? ] filter ] keep [ item>> ] swap map-as ;\r
+    [ lcs-diff [ retain? ] filter ] keep [ item>> ] swap map-as ;\r