Support of algebraic operations on sets
siguctua at gmail.com
Fri Jun 15 17:02:52 UTC 2007
On 15/06/07, Klaus D. Witzel <klaus.witzel at cobss.com> wrote:
> On Fri, 15 Jun 2007 18:39:21 +0200, sig wrote:
> > On 15/06/07, Klaus D. Witzel <klaus.witzel at cobss.com> wrote:
> >> On Fri, 15 Jun 2007 18:04:19 +0200, sig wrote:
> >> >>
> >> >> So you do (aDict keys op: bDict keys)? Is any #op: you need for that
> >> not
> >> >> in Set and its superclasses?
> >> >>
> >> > No its not. But i'd rather like to see aDict op: bDict with same
> >> > semantics.
> >> An example:
> >> aDict := Dictionary with: $a->1 with: $c->2.
> >> bDict := Dictionary with: $b->3 with: $c->4.
> >> aDict union: bDict
> >> => a Dictionary($a->1 $b->3 $c->4 )
> >> Why would anybody be happy with $c->4, I expected $c->2. You see what I
> >> mean (when I wrote earlier that no cDict can hold the "correct" values)?
> >> The expected result is application specific, no?
> > i would care of seeing correct number of keys in algebraic ops at first
> > place.
> Ah :)
> aColl := OrderedCollection with: $a->1 with: $c->2.
> bColl := OrderedCollection with: $b->3 with: $c->4.
> aColl union: bColl
> a Set($a->1 $c->2 $b->3 $c->4)
> You also might want to consider using
> Association subclass: #SigAssociation ...
> SigAssociation methodsFor: 'comparision'
> = argv
> ^ super = argv and: [self value = argv value]
this code is exactly same as in current implementation in Association
in my 3.8 image. Do things changed already? :)
To what i propose is to be the following:
SigAssociation methodsFor: 'comparision'
^ key = argv key
More information about the Squeak-dev