From fe0c636ffee98b18009bbed3c84c6090b6dcda83 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 9 Jan 2009 17:58:13 -0600 Subject: [PATCH] Re-add words-matching, and add new vocabs-matching words, for use by new listener completion --- basis/tools/completion/completion.factor | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/basis/tools/completion/completion.factor b/basis/tools/completion/completion.factor index 55e58ebf14..3e32bf62e5 100644 --- a/basis/tools/completion/completion.factor +++ b/basis/tools/completion/completion.factor @@ -1,8 +1,8 @@ -! Copyright (C) 2005, 2008 Slava Pestov. +! Copyright (C) 2005, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel arrays sequences math namespaces strings io fry -vectors words assocs combinators sorting unicode.case -unicode.categories math.order ; +USING: accessors kernel arrays sequences math namespaces +strings io fry vectors words assocs combinators sorting +unicode.case unicode.categories math.order vocabs ; IN: tools.completion : (fuzzy) ( accum ch i full -- accum i ? ) @@ -68,7 +68,8 @@ IN: tools.completion [ '[ >lower _ [ completion ] with map rank-completions ] ] bi if-empty ; -: limited-completions ( short candidates -- seq ) - [ completions ] [ drop ] 2bi - 2dup [ length 50 > ] [ empty? ] bi* and - [ 2drop f ] [ drop 50 short head ] if ; +: words-matching ( str -- seq ) + all-words [ dup name>> ] { } map>assoc completions ; + +: vocabs-matching ( str -- seq ) + vocabs [ dup name>> ] { } map>assoc completions ; \ No newline at end of file