COMMUNITY

Neat Way Of Removing Duplicates From Array


#1

Hello and thanks for all of the amazing work,

I was wondering what would be considered a neat way to pass to something an array and have its duplicate values removed ?

Thanks again !


(Brian Tiffin) #2

It might be overkill, depending on need, but hashtables in Neko work out fairly well; not a bad read

http://rosettacode.org/wiki/Remove_duplicate_elements#Neko

Still studying Neko, so haven’t played with higher level Haxe hash routines, but I’m assuming it’s nearly a one liner with comprehension.

Or, eat the O(1) and scan for members before insert? Again, I’m assuming that’s a one block expression in Haxe.

Or, someone more experienced will chime in. :slight_smile:

Have good, dedup well


(tokiop) #3

For future reference, Mark shared some code on haxe’s gitter :slight_smile: