USING: io io.files splitting sequences kernel assocs vectors ; IN: inverted-index : file-words ( file -- seq ) contents " \n\r\t" split [ empty? not ] subset ; : index-words ( seq file index -- ) [ >r swap r> [ ?push ] change-at ] 2curry each ; : index-file ( file index -- ) >r dup file-words swap r> index-words ;