1 Requires [ collections ]
5 | bag dumpBag dumpBagX |
8 'bag:(' print. s size print. ')' print.
9 s do: [:e | ' ' print. e print. ].
14 'bag:(' print. s size print. ')' print.
15 s itemsDo: [:e | ' ' print. e print. ].
35 bag remove: 128 ifAbsent: [ 'no element!' printNl ].
38 "and now for something big"
39 1 to: 32 do: [:i | bag << i ].
42 2 to: 32 by: 2 do: [:i | bag remove: i ].
45 (bag includes: 5) ifFalse: [ 'FAIL!' printNl ].
46 (bag includes: 6) ifTrue: [ 'FAIL!' printNl ].