Am 20.05.2011 um 19:13 schrieb David Chisnall: > On 20 May 2011, at 17:20, Dr. H. Nikolaus Schaller wrote: > >> Why aren't you using a NSArray/CFArray to simulate a NSSet? They are much >> more similar than >> dictionaries and sets. > > > Not really. A dictionary is just a set of pairs, where equality is defined > by comparing just the first elements of the pairs. An array is an ordered > collection where an elements can occur multiple times. A set is an unordered > collection where elements may occur at most once. They have very little in > common.
It is easy to use an array like a set by: a) ignoring that an array has an index b) and just checking if a new value is already stored to avoid duplicates. Both have a count, can be enumerated, copied, extended by new objects, checked if some object is contained. I.e. exactly 2 differences and at least 5 commonalities... Makes at least 71% similarity :) One can live wihout NSSet, but you can't without NSArray and NSDictionary... _______________________________________________ Gnustep-dev mailing list [email protected] https://lists.gnu.org/mailman/listinfo/gnustep-dev
