Proposing a new function for lists: Remove Duplicates

Proposing a new function for lists: Remove Duplicates

Currently I use a cumbersome way to create a list and then feed unique values to another list all for the purpose of removing duplicates. The USER_IDS is an integer list of record IDs. Because of the way my database is constructed, if the criteria is met, this list can have duplicates. To remove them, I have to feed the list of IDs to another list (UNIQUE_IDS) as long as the ID is not already there.

  1. USER_IDS = (DATABASE[(USER_DATA.contains(r.SUBLIST) && STATUS == "CONF")].ID).getall();
  2.     for each n in USER_IDS
  3.     {
  4.         if(!UNIQUE_IDS.contains(n))
  5.         {
  6.             UNIQUE_IDS.add(n);
  7.         }
  8.     }

What I am proposing is a simple function that takes a list, and removes all duplicates:

  1. USER_IDS = (DATABASE[(USER_DATA.contains(r.SUBLIST) && STATUS == "CONF")].ID).getall();
  2. USER_IDS.removedups();
It should work for both string and integer lists.

John M. Whitney