www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Array property 'unique'

reply Charlie <Charlie_member pathlink.com> writes:
I think this would be useful, would return the unique elements in the array .

Thoughts ?

Charlie


-
uber clarification

char [] a;
a ~= "a";
a ~= "b";
a ~= "c";
a ~= "c";

char [] b = a.unique; yields ("a","b","c")
Jun 29 2004
parent reply Regan Heath <regan netwin.co.nz> writes:
On Wed, 30 Jun 2004 00:41:02 +0000 (UTC), Charlie 
<Charlie_member pathlink.com> wrote:

 I think this would be useful, would return the unique elements in the 
 array .

 Thoughts ?
You can probably do this with a template, the DTL will almost certainly have a template for doing it. Matthew's DTL (the only one in production that I know of) might already, we should ask him.. Matthew?
 Charlie


 -
 uber clarification

 char [] a;
 a ~= "a";
 a ~= "b";
 a ~= "c";
 a ~= "c";

 char [] b = a.unique; yields ("a","b","c")
-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 29 2004
parent Sam McCall <tunah.d tunah.net> writes:
Regan Heath wrote:

 On Wed, 30 Jun 2004 00:41:02 +0000 (UTC), Charlie 
 <Charlie_member pathlink.com> wrote:
 
 I think this would be useful, would return the unique elements in the 
 array .

 Thoughts ?
You can probably do this with a template, the DTL will almost certainly have a template for doing it. Matthew's DTL (the only one in production that I know of) might already, we should ask him.. Matthew?
He can't hear you... "I love deadlines. I especially like the whooshing sound they make as they go flying by." -- Douglas Adams Sam
 
 Charlie


 -
 uber clarification

 char [] a;
 a ~= "a";
 a ~= "b";
 a ~= "c";
 a ~= "c";

 char [] b = a.unique; yields ("a","b","c")
Jun 29 2004