|
Re: bags use: msg#00088lang.smalltalk.squeak.beginners
aBag := Bag new. aBag add: ... add some of your objects. aBag anySatisfy: [:each | (each name = 'aName') & (each status = 'good')] assuming that your class has implemented instance methods #name, and #status. #anySatisfy: will work with all collection types. You not need to use a Bag. Also do not confuse Smalltalk terminology regarding identity and equality. Identity comparisons #== always checks to see if the lhs and rhs objects are the same object. objectA == objectB -- is true if and only if objectA refers to the same object as objectB. Equality comparisons #= objectA = objectB --tests to see if the two objects are equivalent. If you want to perform equality tests between objects then define the #= instance method for the objects class. You should also define #hash. See class Point for examples for implementing #= and #hash. On 21/06/06, Benjamin SALLAS <benjamin.sallas@xxxxxxxxxx> wrote: hello, -- --- Edward Stow
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | bags use, Benjamin SALLAS |
|---|---|
| Next by Date: | Re: linux squeak startup, stéphane ducasse |
| Previous by Thread: | bags use, Benjamin SALLAS |
| Next by Thread: | Headless Seaside Server with Squeak/VNC? (Was: linux squeak startup), Mark Aufflick |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |