1 ! Copyright (C) 2012 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
4 USING: fry help help.markup help.topics io kernel memoize
5 sequences sequences.deep sorting splitting strings unicode.case
12 : (article-words) ( name -- words )
13 article-content [ string? ] filter
14 [ >lower [ blank? ] split-when ] map concat
15 [ CHAR: - over member? [ "-" split ] when ] map
18 MEMO: article-words ( name -- words )
20 dup [ letter? not ] any? [
21 [ [ letter? ] [ digit? ] bi or not ] split-when
23 ] map flatten [ [ digit? ] all? not ] filter harvest ;
27 : search-docs ( string -- seq' )
28 [ all-articles ] dip >lower [ blank? ] split-when
29 '[ article-words [ _ member? ] any? ] filter
30 [ article-name ] sort-with ;
32 : search-docs. ( string -- )
33 search-docs [ ($link) nl ] each ;