Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My set theory knowledge just says that the union of two sets gives you all the elements in them, with no repeats, so I would also follow your thinking. Even when I work with mathematica, I often union two lists to remove duplicate entries, because mathematica makes sure to remove duplicate entries.

The no-duplicates would seem to be a very important thing about union, and when they are removed or not. Union is just the complement of intersect, which would be the empty set for (a a) int. (b). So the union would be all the elements: (a a b) and after removing all duplicates you'd get (a b), which is exactly the behavior what you and I expect. Must be something with the duplicates rule.



Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: