> I'm just guessing there the answer may just be "equal values are equal and 
> you should never care which one you get out".  There are times to care 
> though, but then perhaps just don't use `distinct` or be sure to have a test 
> on it.  :P

 

Can you provide a scenario when it matters? Given that you had two immutable, 
equal values in a collection, when would it matter which one was discarded and 
which one was kept?

 

Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

 

On 12/29/16, 1:15 PM, "Mike Rodriguez" <clojure@googlegroups.com on behalf of 
mjr4...@gmail.com> wrote:

 

Yeah, adding a test for undocumented behavior seems somewhat reasonable.  I do 
wish the docs would be a bit clearer on these aspects of the contract.  Without 
that it just doesn't seem that there is any real commitment to the Clojure 
implementation to not change later.

 

I understand the general idea of "it is the most natural way to implement it".  
However, that is shaky grounds to rely on.  It also makes me question if I've 
really thought it through to know "there isn't any other way to do it".  In the 
case of `distinct` I can be fairly sure it won't reorder them.

 

Also, it still isn't clear if it keeps the first or later duplicates or not.  
That was the (2) part of the question.  I'm just guessing there the answer may 
just be "equal values are equal and you should never care which one you get 
out".  There are times to care though, but then perhaps just don't use 
`distinct` or be sure to have a test on it.  :P

 

I asked this question mostly out of curiosity and to see what others thought.  
Also, to bring up the issue of if the docs are sufficient.  

 

 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to