Support of algebraic operations on sets

Bert Freudenberg bert at
Fri Jun 15 17:18:07 UTC 2007

On Jun 15, 2007, at 18:58 , sig wrote:

> Lets take an example from real life: we have two dictionaries with
> translation of words from one language into another.

book1 := {'hi'->'ho'. 'mu'->'ma'} as: Dictionary.
book2 := {'hi'->'ho'. 'foo'->'bar'. 'be'-> 'boo'} as: Dictionary.

> Now, the task is
> to compare these books to find out, what book contains more
> translations

book1 size > book2 size

> and to find out what words is missing in first book that
> holds second one.

new := book2 keys difference: book1 keys

> Then, after finding them out, merge new words with
> first book.

new do: [:k | book1 at: k put: (book2 at: k)].

> Or remove them from second book.

new do: [:k | book2 removeKey: k].

- Bert -

More information about the Squeak-dev mailing list