# Elements in a list [closed]

I have a list of molecule SMILES, I want to double check if I have repeated elements in my list. How do I check that, using the function "if"? When I try the function "if" for two different lists, it works, but not if I use the same list with two different names.

• Can't fully answer without some code or some sample data, but... I'm assuming that a SMILES representation is a string. I'm also assuming that a SMILES representation has a canonical form so that we don't have to worry about semantic interpretation of the entry--we only need to look at the string representation to determine duplicates. Give these assumptions, you probably want to start with DuplicatesFreeQ, DeleteDuplicates, and maybe some string-pattern-matching like StringMatchQ. Jun 21 at 21:04
• It would be helpful to see how your if-based solution worked and how it didn't. Jun 21 at 21:04
• You should be able to use MoleculeValue[mol, "CanonicalSMILES"] or MoleculeValue[mol, "IsomericSMILES"] to canonicalize your molecules before using Union[] or DeleteDuplicates[]. See also MoleculeMatchQ[]. Jun 21 at 21:10
• The title of the post can be modified/improved.
– Syed
Jun 22 at 7:58