uniq and array of enum members (That are all strings)
bauss
jj_1337 at live.dk
Wed Jan 16 17:46:29 UTC 2019
On Wednesday, 16 January 2019 at 17:28:14 UTC, Alex wrote:
> On Wednesday, 16 January 2019 at 16:52:50 UTC, bauss wrote:
>> The problem with sorting is that the following:
>>
>> [3,5,6,6,2,1,2,5,3]
>>
>> will then become
>>
>> [1,2,3,5,6]
>>
>> or
>>
>> [6,5,3,2,1]
>>
>> and not:
>>
>> [3,5,6,2,1]
>>
>> which would be what you'd wanna use in some situations.
>>
>> The important thing to know here is that the numbers are not a
>> sequence, they're a set of numbers.
>>
>> It's important the set doesn't have a change of order.
>>
>> The filter example works and that's what I already did.
>>
>> But something that is a bit better would be appreciated.
>>
>> Sorting really makes no sense to make something unique.
>>
>> It makes sense for the most "trivial" implementation, but not
>> the most trivial usages.
>
> Ah... I see. You want something like a special fold by
> filtering... hmm ;)
Yep.
I just want to make sure there are no duplicates in the array
while maintaining the order of the items.
More information about the Digitalmars-d-learn
mailing list