Friday, 30 October 2015

Collections notes


ALL collections understand
includes: , isEmpty and occurrencesOf: 
the enumeration messages do:select:reject: ,  detect:ifNone: , 
collect: (which is like lisp’s map),, inject:into: (which performs a left fold) and many more

add:  answers with its argument NOT with the amended collection.

A key uniquely identifies some object or row.

Bag - a Set where it will count the number of instances of each member ?
(An unordered collection of objects. i.e. a set with a memory. if the same object is added twice, it will report that the element has been stored twice.)

A Set provides an unordered collection of unique elements.  i.e. if you add a duplicate of an existing item, nothing happens.

IdentitySet (and IdentityDictionary) has integers or Symbols as the key values

Collections can be
sequenced - they proceed from first: to last:

indexed - they also respond to at: (aNumber or aSymbol)
i.e. they have an integer key

keyed: they have an index which is an i

unordered - i.e. they do not respond to

Arrays are of fixed size, and is indexed.

Indexed collections are ones which have an Integer number as their index - i.e. an integer will allow you to access a specific member.

There is a Matrix Class for multi-dimensional arrays

2D = table

3D = volume (GRL term)

There is also SparseLargeTable and its subClass SparseLargeArray

OrderedCollection and its subclass, SortedCollection

Which one is a Dictionary?  Neither.  Class Dictionary (and class SmallDictionary) are dictionaries.

Dictionaries are keyed to a string value.

Only one entry is allowed for each string value.

No comments:

Post a Comment