Support of algebraic operations on sets

sig siguctua at gmail.com
Fri Jun 15 17:23:56 UTC 2007


On 15/06/07, Bert Freudenberg <bert at freudenbergs.de> wrote:
> 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)].

instead of:
  book1 union: book2
>
> > Or remove them from second book.
>
> new do: [:k | book2 removeKey: k].
>
instead of:
  book2 difference: (book1 intersection: book2)


can't you see the difference?
> - Bert -
>
>
>
>



More information about the Squeak-dev mailing list