| 
									
										
										
										
											2008-07-02 01:20:01 -04:00
										 |  |  | ! Copyright (C) 2008 Slava Pestov. | 
					
						
							|  |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2008-12-08 15:58:00 -05:00
										 |  |  | USING: accessors classes sequences kernel namespaces | 
					
						
							| 
									
										
										
										
											2009-08-31 21:32:00 -04:00
										 |  |  | make words math math.parser assocs ;
 | 
					
						
							| 
									
										
										
										
											2008-07-02 01:20:01 -04:00
										 |  |  | IN: summary | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GENERIC: summary ( object -- string )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : object-summary ( object -- string )
 | 
					
						
							|  |  |  |     class name>> " instance" append ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | M: object summary object-summary ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | M: sequence summary | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         dup class name>> % | 
					
						
							|  |  |  |         " with " % | 
					
						
							|  |  |  |         length # | 
					
						
							|  |  |  |         " elements" % | 
					
						
							|  |  |  |     ] "" make ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | M: assoc summary | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         dup class name>> % | 
					
						
							|  |  |  |         " with " % | 
					
						
							|  |  |  |         assoc-size # | 
					
						
							|  |  |  |         " entries" % | 
					
						
							|  |  |  |     ] "" make ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ! Override sequence => integer instance | 
					
						
							|  |  |  | M: f summary object-summary ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | M: integer summary object-summary ;
 |