Hi All,
this used to work: (Set with: #module) = (IdentitySet with: #module) when did this change and why? _,,,^..^,,,_ best, Eliot |
Déjà vu. I think we did make this fix last year, IIRC, you were there.
We have #hasEqualElements: on SequenceableCollection, I think we should have one on Set too. On Mon, Apr 18, 2016 at 1:50 PM, Eliot Miranda <[hidden email]> wrote: > Hi All, > > this used to work: > > (Set with: #module) = (IdentitySet with: #module) > > when did this change and why? > > _,,,^..^,,,_ > best, Eliot > > > |
In reply to this post by Eliot Miranda-2
Hi Eliot,
On Mon, 18 Apr 2016, Eliot Miranda wrote: > Hi All, > this used to work: > > (Set with: #module) = (IdentitySet with: #module) > > when did this change and why? I changed it in Collections-ul.669 last November, because it didn't work well. Let's see a different example: | s i | s := Set with: 'module' copy. i := IdentitySet with: 'module' copy. { s = i. i = s } The old implementation would return #(false true), while the new one evaluates to #(false false). Levente > > _,,,^..^,,,_ > best, Eliot > > |
On Mon, Apr 18, 2016 at 3:43 PM, Levente Uzonyi <[hidden email]> wrote: Hi Eliot, Right. That's a pain, but fair enough. This is clumsy: (aSet size = 1 and: [aSet anyOne = #module]). This slightly less so: aSet = (aSet species with: #module). Levente _,,,^..^,,,_ best, Eliot |
On Mon, 18 Apr 2016, Eliot Miranda wrote:
> > > On Mon, Apr 18, 2016 at 3:43 PM, Levente Uzonyi <[hidden email]> wrote: > Hi Eliot, > > On Mon, 18 Apr 2016, Eliot Miranda wrote: > > Hi All, > this used to work: > > (Set with: #module) = (IdentitySet with: #module) > > when did this change and why? > > > I changed it in Collections-ul.669 last November, because it didn't work well. Let's see a different example: > > | s i | > s := Set with: 'module' copy. > i := IdentitySet with: 'module' copy. > { > s = i. > i = s > } > > The old implementation would return #(false true), while the new one evaluates to #(false false). > > > Right. That's a pain, but fair enough. This is clumsy: (aSet size = 1 and: [aSet anyOne = #module]). This slightly less so: aSet = (aSet > species with: #module). aSet asArray = #(module). or as (aSet as: Set) = (Set with: #module). Levente > > Levente > > _,,,^..^,,,_ > best, Eliot > > > _,,,^..^,,,_ > best, Eliot > > |
In reply to this post by Eliot Miranda-2
Hi Eliot,
try this: (Set with: #module) includesAllOf: (IdentitySet with: #module). This is "hasEqualElements:" for all kinds of collections. Best, Marcel |
On 19.04.2016, at 08:23, marcel.taeumel <[hidden email]> wrote: > Hi Eliot, > > try this: > (Set with: #module) includesAllOf: (IdentitySet with: #module). > > This is "hasEqualElements:" for all kinds of collections. But this is not reflexive, right? (Set withAll: #(module moep)) includesAllOf: (IdentitySet with: #module) > > Best, > Marcel |
In reply to this post by Levente Uzonyi
On Mon, Apr 18, 2016 at 5:18 PM, Levente Uzonyi <[hidden email]> wrote: On Mon, 18 Apr 2016, Eliot Miranda wrote: Expensive when aSet is large. I've gone with the anyOne form. Levente _,,,^..^,,,_ best, Eliot |
In reply to this post by Tobias Pape
Hi Marcel,
On Tue, Apr 19, 2016 at 12:32 AM, Tobias Pape <[hidden email]> wrote:
How about Set>>hasEqualElements: aCollection ^aCollection size = self size and: [aCollection noneSatisfy: [:element| (self includes: element) not] Again it's not reflexive with sequenceable collections, but unlike includesAllOf: it meets the specification ;-).
_,,,^..^,,,_ best, Eliot |
On 19.04.2016, at 18:11, Eliot Miranda <[hidden email]> wrote: > Hi Marcel, > > On Tue, Apr 19, 2016 at 12:32 AM, Tobias Pape <[hidden email]> wrote: > > On 19.04.2016, at 08:23, marcel.taeumel <[hidden email]> wrote: > > > Hi Eliot, > > > > try this: > > (Set with: #module) includesAllOf: (IdentitySet with: #module). > > > > This is "hasEqualElements:" for all kinds of collections. > > But this is not reflexive, right? > > (Set withAll: #(module moep)) includesAllOf: (IdentitySet with: #module) > > How about > > Set>>hasEqualElements: aCollection > ^aCollection size = self size and: [aCollection noneSatisfy: [:element| (self includes: element) not] > > > Again it's not reflexive with sequenceable collections, but unlike includesAllOf: it meets the specification ;-). I think I was incorrect, I think what I meant is commutative. Best -Tobias > > > > > > > Best, > > Marcel |
Free forum by Nabble | Edit this page |