summary: adding summary of sets.
parent
97530d86d4
commit
76e32e8a5f
|
@ -1,13 +1,12 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors assocs classes continuations kernel make math
|
||||
math.parser sequences ;
|
||||
math.parser sequences sets ;
|
||||
IN: summary
|
||||
|
||||
GENERIC: summary ( object -- string )
|
||||
|
||||
: object-summary ( object -- string )
|
||||
class-of name>> ; inline
|
||||
: object-summary ( object -- string ) class-of name>> ; inline
|
||||
|
||||
M: object summary object-summary ;
|
||||
|
||||
|
@ -27,6 +26,14 @@ M: assoc summary
|
|||
" entries" %
|
||||
] "" make ;
|
||||
|
||||
M: set summary
|
||||
[
|
||||
dup class-of name>> %
|
||||
" with " %
|
||||
cardinality #
|
||||
" members" %
|
||||
] "" make ;
|
||||
|
||||
! Override sequence => integer instance
|
||||
M: f summary object-summary ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue