 GENERIC: toggle-coverage ( object -- )
 
 M: string toggle-coverage
-    [ toggle-coverage ] change-vocabulary-coverage ;
+    [ toggle-coverage ] each-word ;
 
 M: word toggle-coverage
     dup "coverage" word-prop [

: private-vocab-name ( string -- string' )
    ".private" ?tail drop ".private" append ;

: change-vocabulary-coverage ( string quot -- )
    over ".private" tail? [
        [ words ] dip each
    ] [

        [ name>> ":" append print ]
        [ [ bl bl bl bl . ] each ] bi*
    ] if-empty ;

GENERIC: count-callables ( object -- n )

M: string count-callables
    [ count-callables ] map-word sum ;

M: word count-callables
    def>> [ callable? ] deep-filter length ;

GENERIC: %coverage ( object -- x )

: calculate-%coverage ( object quot -- x )
    [ count-callables ] bi [ swap - ] keep /f ; inline

M: string %coverage
    [ coverage values concat length ] calculate-%coverage ;

M: word %coverage
    [ coverage length ] calculate-%coverage ;
