]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/help/search/search.factor
core: subseq-index? -> subseq-of?
[factor.git] / basis / help / search / search.factor
index 87db04467f5b77987ce0c8ce8e5790b973e73b7a..7c4a4b10f4fc1dc18a4179e78ec841b16058ae24 100644 (file)
@@ -1,11 +1,10 @@
 ! Copyright (C) 2012 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license
 
-USING: arrays assocs combinators combinators.short-circuit fry
-help help.apropos help.markup help.stylesheet help.topics io
-io.streams.string io.styles kernel math memoize namespaces
-sequences sequences.deep sorting splitting strings unicode
-words ;
+USING: arrays combinators combinators.short-circuit help
+help.apropos help.markup help.stylesheet help.topics io
+io.styles kernel math namespaces sequences sorting splitting
+strings unicode words ;
 
 IN: help.search
 
@@ -21,16 +20,16 @@ IN: help.search
             { \ $vocab-link [ second ] }
             { \ $emphasis [ second ] }
             { \ $subsection [ second article-name ] }
-            { \ $subsections [ rest [ article-name ] map " " join ] }
-            { \ $description [ rest [ element-value ] map " " join ] }
-            { \ $notes [ rest [ element-value ] map " " join ] }
-            { \ $snippet [ rest [ element-value ] map " " join ] }
+            { \ $subsections [ rest [ article-name ] map join-words ] }
+            { \ $description [ rest [ element-value ] map join-words ] }
+            { \ $notes [ rest [ element-value ] map join-words ] }
+            { \ $snippet [ rest [ element-value ] map join-words ] }
             [ 2drop f ]
         } case
     ] [ dup string? [ drop f ] unless ] if ;
 
 MEMO: article-words ( name -- words )
-    article-content [ element-value ] map " " join search-words
+    article-content [ element-value ] map join-words search-words
     [ [ digit? ] all? ] reject
     [ [ { [ letter? ] [ digit? ] } 1|| not ] trim ] map! harvest  ;
 
@@ -38,7 +37,7 @@ MEMO: article-words ( name -- words )
     search-words [ { } ] [
         [ all-articles ] dip
         dup length 1 > [
-            '[ article-words _ swap subseq? ] filter
+            '[ article-words _ subseq-of? ] filter
         ] [
             first '[ article-words [ _ head? ] any? ] filter
         ] if