RE: Wishing well

郭雪松 <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
Consider this:

Howto create a array of multiset, every item of the array should be uniq. using ByValue, I do it like this:

array res=({});
multiset done=(<>);
for(int i=0;i<100;i++){
 for(int j=0;j<100;j++){
  int t=random(100);
  object ob=ByValue.Set(i,j,t);
  if(!done[ob])
   res+=({(<i,j,t>)});
 }
}

If we do not use ByValue, but using equal() manually, It's much complacated and boring.

Guo Xue Song


> Date: Tue, 18 Nov 2014 23:16:04 +1100
> Subject: Re: Wishing well
> From: [email protected]
> CC: [email protected]
> To: [email protected]
> 
> On Tue, Nov 18, 2014 at 11:10 PM, 郭雪松 <[email protected]> wrote:
> >> this is actually one of the things i miss in pike.
> >
> > I wish there are multiset/mapping/array compared by values.
> 
> Can you simply use equal() rather than == when you want to compare values?
> 
> ChrisA
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.