Jump to content

Talk:Symmetric difference: Difference between revisions

(→‎Set type: Downgrade note.)
Line 15:
::Oh, I don't think it is hard to do, I just think that because we are dealing with sets then it isn't right to have the chance of duplicates in outputs. --[[User:Paddy3118|Paddy3118]] 07:23, 2 February 2010 (UTC)
:::Alright, this doesn't make sense to me. I understand what you said in the [http://rosettacode.org/mw/index.php?title=Symmetric_difference&diff=74493&oldid=prev log entry], and I'll admit I was unfamiliar with that requirement of "set", but if we're insisting on a strict definition of "set", I don't see how it makes sense to hold examples in languages without a set type to a different requirement. If the data passed into the program has duplicates within a list, then that list isn't a set. I would recommend leaving the note, but reducing it to a "optionally, verify your inputs," rather than a language-attribute-conditional requirement. --[[User:Short Circuit|Michael Mol]] 15:12, 9 February 2010 (UTC)
 
::::Hi Michael, I wrote the note because of personal experience. before Python had an explicit set type I had learned to ''not'' use lists as sets because of the duplicates issue. I n Python the idiom then was to use the keys of a dictionary (map or hash) and code around that to make it look like a set. It was quicker to find out if a key is in a dict than in a list and the keys of a dict are unique. Seeing more than one of the RC examples using lists, and knowing how easy it is to have duplicates in a list made me check the algorithms used.
::::I reasoned that the task is about sets. If I use a set type then the type ensures there are no duplicates. Isn't it fair that if another example is using lists then either they show how their lists are further constrained to work as sets, or that the algorithm will give a set-like answer if such checks are not shown? --[[User:Paddy3118|Paddy3118]] 23:39, 9 February 2010 (UTC)
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.