Am 29.12.2005 um 22:24 schrieb David T. Lewis:
Quite right. For example:
(String streamContents: [:stream | 'A series of words to be shuffled' substrings shuffled do: [:e | stream nextPutAll: e; nextPut: Character space]]) allButLast
or:
String streamContents: [:stream | 'A series of words to be shuffled' substrings shuffled inject: '' into: [:sep :e | stream nextPutAll: sep; nextPutAll: e. ' ']]
#do:separatedBy: is meant exactly for that. Also, Stream understands #space itself:
(String streamContents: [:stream | 'A series of words to be shuffled' substrings shuffled do: [:each | stream nextPutAll: each] separatedBy: [stream space]])
- Bert -