factor/library/tools/summary.factor

24 lines
594 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.
2006-08-25 21:29:23 -04:00
IN: prettyprint
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: input summary
"Input: " swap input-string dup string?
[ "\n" split1 "..." "" ? append ] [ unparse-short ] if
append ;
2006-07-31 21:30:06 -04:00
M: vocab-link summary
2006-07-31 21:30:06 -04:00
[
vocab-link-name dup %
" vocabulary (" %
words length #
" words)" %
] "" make ;