[Gambas-devel] Please Benoit i want this !!

Tobias Boege taboege at ...176...
Fri Nov 28 21:20:22 CET 2014


On Fri, 28 Nov 2014, Beno?t Minisini wrote:
> Le 26/10/2014 11:53, Fabien Bodard a ?crit :
> > Private Function GetDiffArray(Array1 As Integer[], Array2 As
> > Integer[]) As Integer[]
> >
> >    Dim aRet As New Integer[]
> >    Dim i As Integer
> >
> >    For Each i In Array2
> >      If Array1.Exist(i) Then Continue
> >      aRet.Add(i)
> >    Next
> >    Return aRet
> >
> > End
> >
> >
> >
> > Is it possible to add this in a native way :
> >
> > MyArray1.Diff(MyArray2) as array ?
> >
> >
> >
> > For example in a string it will give
> >
> > Destination to do :
> > [Dest1, Dest2, Dest3, Dest4]
> >
> > Destination Done
> > [Dest1, Dest3]
> >
> > Dest remain :
> > [Dest2, Dest4]
> >
> >
> > I use this to manage a doc cache. In the view i have for example Doc10
> > to Doc 16 showed.  If i scroll then the doclist change ... so i have
> > to remove a part of the doc from the cache and then charge another
> > one.
> >
> >
> > Regards,
> > Fabien
> >
> 
> This is not simple. You want set operators on arrays, and arrays are not 
> set. They can have the same elements more than once.
> 
> For example, if one set operator need to remove an element from an 
> array, what should it do if the element is included twice? Remove the 
> first one? Remove both?
> 
> Maybe a Set class? I don't know if Tobias put a Set class in its gb.data 
> component...
> 

I haven't. I do want to add one though. I didn't come across implementation
techniques other than a hashtable yet and don't know if there are better
ones. Especially because a set needs to identify arbitrary objects...

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the Devel mailing list