         drop vocabs-matching keys [
             [ vocab-words ] [ vocab-name ] bi ":" append
             [ over name>> append ] curry { } map>assoc
-        ] map! concat
+        ] map concat
     ] [ drop f ] if* ;
 
 : words-matching ( str -- seq )
-    [ all-words named ]
-    [ qualified-named [ append ] unless-empty ] bi
-    completions ;
+    all-words named over qualified-named [ append ] unless-empty completions ;
 
 : chars-matching ( str -- seq )
     name-map keys dup zip completions ;

: score-1 ( i full -- n )
    {
        { [ over zero? ] [ 2drop 10 ] }
        { [ 2dup length 1 - number= ] [ 2drop 4 ] }
        { [ 2dup [ 1 - ] dip nth-unsafe Letter? not ] [ 2drop 10 ] }
        { [ 2dup [ 1 + ] dip nth-unsafe Letter? not ] [ 2drop 4 ] }
        [ 2drop 1 ]

! Copyright (C) 2005, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs colors combinators
combinators.short-circuit io.directories io.files io.files.info
io.pathnames kernel locals make math math.order sequences
sequences.private sorting splitting splitting.monotonic unicode
unicode.data vectors vocabs vocabs.hierarchy ;
IN: tools.completion

<PRIVATE

: fuzzy-index-from ( ch i seq -- n/f )
    rot [ ch>lower ] [ ch>upper ] bi
    '[ dup _ eq? [ drop t ] [ _ eq? ] if ] find-from drop ;

:: (fuzzy) ( accum i ch full -- accum i ? )
    ch i full fuzzy-index-from [
        [ accum push ]
        [ accum swap 1 + t ] bi
    ] [
        f f f
    ] if* ; inline

PRIVATE>

: fuzzy ( full short -- indices )
    [ V{ } clone 0 ] 2dip swap '[ _ (fuzzy) ] all? 2drop ;

: runs ( seq -- newseq )
    [ 1 - = ] monotonic-split-slice ;
