factor/extra/tools/crossref/crossref.factor

23 lines
724 B
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
! Copyright (C) 2005, 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays definitions assocs io kernel
math namespaces prettyprint sequences strings io.styles words
generic tools.completion quotations parser inspector
2008-02-05 00:30:59 -05:00
sorting hashtables vocabs parser source-files ;
2007-09-20 18:09:08 -04:00
IN: tools.crossref
: synopsis-alist ( definitions -- alist )
[ dup synopsis swap ] { } map>assoc ;
: definitions. ( alist -- )
[ write-object nl ] assoc-each ;
: usage. ( word -- )
smart-usage synopsis-alist sort-keys definitions. ;
: words-matching ( str -- seq )
all-words [ dup word-name ] { } map>assoc completions ;
: apropos ( str -- )
words-matching synopsis-alist reverse definitions. ;