Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #2050 (new enhancement)

Opened 13 years ago

Last modified 13 years ago

Extended Version of tango.core.Array.distinct

Reported by: Marenz Assigned to: community
Priority: major Milestone: 1.0
Component: Tango Version: trunk
Keywords: array, distinct, sort, sorted Cc:

Description

I modified the existing "distinct" function to always keep the lowest (lowest according to the < predicate or a supplied one) from consecutive groups.

Maybe you have interest for it?

Attachments

Array.d-distinctSort.2.patch (4.3 kB) - added by Marenz on 05/09/11 12:07:57.
new function distinctSort
Array.d-distinctSort.patch (4.3 kB) - added by Marenz on 05/09/11 12:47:53.
part was commented out :o

Change History

05/09/11 12:07:57 changed by Marenz

  • attachment Array.d-distinctSort.2.patch added.

new function distinctSort

05/09/11 12:08:24 changed by Marenz

(second version fixes some typos)

05/09/11 12:47:53 changed by Marenz

  • attachment Array.d-distinctSort.patch added.

part was commented out :o

05/09/11 14:51:44 changed by mwarning

a few thoughts:

  • shouldn't distinctSort_ be private?
  • why return size_t instead of a slice? (isn't that the way D encourages?)
  • isn't there such a function in Tango already? (haven't really had a look yet)

05/09/11 15:24:17 changed by Marenz

This is almost a direct copy of the existing distinct function. The only thing I changed is that it sorts the sub-groups using a provided function.

Almost every function in core.Array returns a size_t.

05/20/11 14:21:26 changed by mwarning

What I remember from the discussion on between you and kirs on #d.tango is that this function probably doesn't have enough demand to be included. - Remarks?

05/20/11 19:36:58 changed by larsivi

why size_t as the return type should be well documented I think.

As for including the function, at least _some_ demand is needed, in the form of sensible usecases.

06/23/11 19:55:13 changed by larsivi

Or a note as to why this version is better if a replacement is of interest.