I have tried some way to remove some repeat item from a list. Followed is the simple one foreach(item list list=cons(item remove(item list)) ) Do anyone have a more available command or fuction?
This is what I use... procedure(_removeDuplicates(masterList) let((finalList) foreach(item masterList unless(member(item car(finalList)) finalList=tconc(finalList item) ) ) finalList ) ) If your are going through a list of dbids, then you can use memq instead of member to speed this up.
I use "makeTable" because it doesn't accept duplicates.below is code from a program I wrote called highlight_padstacks.il that is in the downloadable user skill zip file from cadence. I make a list by selecting all pins and via, and then load the names into a table. padstacklist=makeTable("atable1" 0) axlSetFindFilter(?enabled list("noall" "pins" "vias") ?onButtons list("noall" "pins" "vias"))axlAddSelectAll()pin_list = axlGetSelSet()foreach(pin_db pin_list padstack_db = pin_db->definition ;Extract PadstackID from pinID pad_name=padstack_db->name ;Extract Padstack Name from PadstackID padstacklist[pad_name]=pad_name ;Load into table as Name:Value );end foreach
Now I use below code to this solution:procedure( RemoveDuplicateItem(A) B=nil while(A!=nil B=cons(nth(0 A) B) A=remove(nth(0 A) A)) B );procedure
You could try using the unique functionFor example, this will weed out all duplicate via names from a list:
via_name_list = unique(sort( via_name_list 'alphalessp))
ulist = nilforeach( obj obj_list unless( member( obj ulist) ulist = cons( obj ulist) );end-unless);end-foreach
It's wonderful for the unique function. which user guide offers these functions?I don't know the Cadence guru position. where~~