]> gitweb.factorcode.org Git - factor.git/commitdiff
boyer-moore: fixed indentation, typos
authorDmitry Shubin <dmitry.sh@gmail.com>
Fri, 16 Apr 2010 00:44:37 +0000 (04:44 +0400)
committerDmitry Shubin <dmitry.sh@gmail.com>
Fri, 16 Apr 2010 00:44:37 +0000 (04:44 +0400)
extra/boyer-moore/boyer-moore-docs.factor
extra/boyer-moore/boyer-moore.factor
extra/z-algorithm/z-algorithm.factor

index 994971e208a8163feb3d024f00e74b2d54c2a2c7..d87f431ee7fa14c70e3ccf10317b1b66dc818784 100644 (file)
@@ -1,11 +1,11 @@
 ! Copyright (C) 2010 Dmitry Shubin.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: help.markup help.syntax kernel sequences ;
+USING: boyer-moore.private help.markup help.syntax kernel sequences ;
 IN: boyer-moore
 
 HELP: <boyer-moore>
 { $values
-  { "pat" sequence } { "bm" object }
+  { "pat" sequence } { "bm" boyer-moore }
 }
 { $description
   "Given a pattern performs pattern preprocessing and returns "
@@ -43,7 +43,7 @@ ARTICLE: "boyer-moore" "The Boyer-Moore algorithm"
 { $heading "Summary" }
 "The " { $vocab-link "boyer-moore" } " vocabulary "
 "implements a Boyer-Moore string search algorithm with "
-"so-called 'strong good suffix shift rule'. Since agorithm is "
+"so-called 'strong good suffix shift rule'. Since algorithm is "
 "alphabet-independent it is applicable to searching in any "
 "collection that implements " { $links "sequence-protocol" } "."
 
@@ -51,8 +51,8 @@ ARTICLE: "boyer-moore" "The Boyer-Moore algorithm"
 "Let " { $snippet "n" } " and " { $snippet "m" } " be lengths "
 "of the sequences being searched " { $emphasis "in" } " and "
 { $emphasis "for" } " respectively. Then searching runs in "
-{ $snippet "O(n)" } " time in it's worst case using additional "
-{ $snippet "O(m)" } " space. Preprocessing phase runs in "
+{ $snippet "O(n)" } " time in its worst case using additional "
+{ $snippet "O(m)" } " space. The preprocessing phase runs in "
 { $snippet "O(m)" } " time."
 ;
 
index 4de88c4a1d6104b6e6704356934a9b745d77bb65..aba3f614a12642c7e5bd9e0d55d97603f39545e6 100644 (file)
@@ -53,10 +53,12 @@ TUPLE: boyer-moore pattern bc-table gs-table ;
     pat length        :> plen
     seq length plen - :> lim
     from
-    [ dup lim <=
-      [ seq pat pick plen mismatch?
-        [ 2dup + seq nth-unsafe bm do-shift t ] [ f ] if*
-      ] [ drop f f ] if
+    [
+        dup lim <=
+        [
+            seq pat pick plen mismatch?
+            [ 2dup + seq nth-unsafe bm do-shift t ] [ f ] if*
+        ] [ drop f f ] if
     ] loop ; inline
 
 PRIVATE>
index 12306dc0803626def87a5e88b5b1e259adb0842e..bd312755a3f7b2fc9f19dc811dd0b0216031ff7c 100644 (file)
@@ -19,8 +19,9 @@ IN: z-algorithm
     r k - 1 +   :> b
     seq Z Zk' b <
     [ Zk' Z push l r ] ! still inside
-    [ seq r 1 + seq b [ tail-slice ] 2bi@ lcp :> q
-      q b + Z push k q r +
+    [
+        seq r 1 + seq b [ tail-slice ] 2bi@ lcp :> q
+        q b + Z push k q r +
     ] if ; inline
 
 : (z-value) ( seq Z l r k -- seq Z l r )