Bag.st
branchjv
changeset 18093 2b786a9af1d0
parent 18091 abbcac10730e
parent 15732 e57fb13f5af2
child 18120 e3a375d5f6a8
--- a/Bag.st	Wed Aug 28 10:49:29 2013 +0100
+++ b/Bag.st	Wed Sep 04 09:43:51 2013 +0100
@@ -142,10 +142,22 @@
      to the bags elements."
 
     ^ contents
+
+    "
+     Bag new
+        add:'abc';
+        add:'def';
+        add:'ghi';
+        add:'abc';
+        add:'def';
+        add:'abc';
+        add:'abc';
+        contents
+    "
 !
 
 sortedCounts
-    "Answer with a collection of counts with elements, sorted by decreasing count."
+    "Answer with a collection of counts associated to elements, sorted by decreasing count."
     "Suggested by l. Uzonyi"
     
     ^ (Array new:contents size
@@ -154,6 +166,18 @@
         ])
         sort:[:x :y | x >= y ];
         yourself
+
+    "
+     Bag new
+        add:'abc';
+        add:'def';
+        add:'ghi';
+        add:'abc';
+        add:'def';
+        add:'abc';
+        add:'abc';
+        sortedCounts
+    "
 ! !
 
 !Bag methodsFor:'adding & removing'!
@@ -486,10 +510,10 @@
 !Bag class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.47 2013-08-23 00:21:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.49 2013-08-31 13:17:33 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.47 2013-08-23 00:21:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.49 2013-08-31 13:17:33 cg Exp $'
 ! !