factor/library/tools/summary.factor

32 lines
791 B
Factor
Raw Normal View History

2006-07-31 21:30:06 -04:00
! Copyright (C) 2005, 2006 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
IN: inspector
2006-08-01 04:45:05 -04:00
USING: generic kernel namespaces prettyprint sequences strings
styles words ;
2006-07-31 21:30:06 -04:00
GENERIC: summary ( object -- string )
M: object summary
"an instance of the " swap class word-name " class" append3 ;
M: word summary
2006-07-31 21:30:06 -04:00
dup word-vocabulary [
dup interned?
"a word in the " "a word orphaned from the " ?
swap word-vocabulary " vocabulary" append3
] [
drop "a uniquely generated symbol"
] if ;
M: input summary
2006-07-31 21:30:06 -04:00
"Input: " swap input-string
dup string? [ unparse-short ] unless append ;
M: vocab-link summary
2006-07-31 21:30:06 -04:00
[
vocab-link-name dup %
" vocabulary (" %
words length #
" words)" %
] "" make ;