Test for element in array

Paolo Invernizzi arathorn at NOSPAM_fastwebnet.it
Sat Jul 15 02:50:42 PDT 2006


Kirk McDonald wrote:
> Derek Parnell wrote:
> You can also have a sort of poor-man's multiset with:
> 
> int[ char[] ] ms;
> 
> One could easily wrap this with a more multiset-ish interface, but to 
> add an item you just say:
> 
> ++ms["moo"];
> 
> And to remove:
> 
> if (--ms["moo"] <= 0) ms.remove("moo");
> 

That's what I liked from python... with dicts (aka AA) and lists (aka 
arrays) you can have basically every container you want.

And some newbie reading the code can grasp the meaning without loosing 
himself in a plethora of containers...

Now python users are complaining against too much features added in the 
language...

---
Paolo



More information about the Digitalmars-d-learn mailing list