diff -r e86757447e81 -r a7c0dda5e0bc Collection.st --- a/Collection.st Wed Sep 26 17:52:10 2001 +0200 +++ b/Collection.st Wed Sep 26 18:14:50 2001 +0200 @@ -1358,6 +1358,34 @@ This is a utility helper for collection printers (for example, to print a space between elements)." + self obsoleteMethodWarning:'use #do:separatedBy:'. + ^ self do:aBlock separatedBy:betweenBlock + + " + #(1 2 3 4) do:[:el | Transcript show:el] + inBetweenDo:[ Transcript show:'-'] + + (Dictionary with:(1->'one') with:(2->'two')) + do:[:el | Transcript showCR:el printString] + inBetweenDo:[ Transcript showCR:'----'] + + (Dictionary with:(1->'one') with:(2->'two')) + associations + do:[:el | Transcript showCR:el printString] + inBetweenDo:[ Transcript showCR:'----'] + + " + + "Modified: / 11.2.2000 / 11:23:15 / cg" +! + +do:aBlock separatedBy:betweenBlock + "evaluate the argument, aBlock for each element. + Between elements (i.e. after each except for the last), + evaluate betweenBlock. + This is a utility helper for collection printers + (for example, to print a space between elements)." + |first| first := true. @@ -1372,16 +1400,16 @@ " #(1 2 3 4) do:[:el | Transcript show:el] - inBetweenDo:[ Transcript show:'-'] + separatedBy:[ Transcript show:'-'] (Dictionary with:(1->'one') with:(2->'two')) do:[:el | Transcript showCR:el printString] - inBetweenDo:[ Transcript showCR:'----'] + separatedBy:[ Transcript showCR:'----'] (Dictionary with:(1->'one') with:(2->'two')) associations do:[:el | Transcript showCR:el printString] - inBetweenDo:[ Transcript showCR:'----'] + separatedBy:[ Transcript showCR:'----'] " @@ -2247,6 +2275,6 @@ !Collection class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.112 2001-09-24 17:54:02 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.113 2001-09-26 16:14:50 cg Exp $' ! ! Collection initialize!