• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. removing repetitions from list with same elements but in...

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 143
  • Views 13861
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

removing repetitions from list with same elements but in reverse order

RAGHU2634
RAGHU2634 over 7 years ago

Hi,

I have a list which looks like this.

for example

a=( (1  2) (2  1)  (1  3)  (3  1) ) .  I need a function to transverse this list  as shown

a=( (1 2) (1 3) )  or a = ( (2  1)  (3  1) )

Thanks,

Raghu

  • Cancel
Parents
  • skillUser
    skillUser over 7 years ago

    Hi Raghu,

    Assuming that 'a' is the original list of four sub-lists you can return the 'odd' or 'even' elements like this:

    
        idx=0 setof(item a idx++ && oddp(idx) && a)
    => ((1 2) 
        (1 3)
        )
    idx=0 setof(item a idx++ && evenp(idx) && a)
    => ((2 1) 
        (3 1)
        )

    Best regards,
    Lawrence.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • RAGHU2634
    RAGHU2634 over 7 years ago in reply to skillUser

    Hi lawrence,

    That is just an example i gave . I am not dealing with numbers in real. Idea is to filter list with same elements i.e; removing repetition

    Thanks,

    Raghu

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to RAGHU2634

    Hi Raghu,

    Your description in the original post was rather unclear - I assumed the same as Lawrence.

    Something like this is probably what you want?

    procedure(CCFfilterReversedLists(l)
        let(((revListTable makeTable('reversedLists nil)))
            setof(sublist l
                unless(revListTable[sublist]
                    when(listp(sublist)
                        revListTable[reverse(sublist)]=t
                    )
                    t
                )
            )
        )
    )
    

    Regards,

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to RAGHU2634

    Hi Raghu,

    Your description in the original post was rather unclear - I assumed the same as Lawrence.

    Something like this is probably what you want?

    procedure(CCFfilterReversedLists(l)
        let(((revListTable makeTable('reversedLists nil)))
            setof(sublist l
                unless(revListTable[sublist]
                    when(listp(sublist)
                        revListTable[reverse(sublist)]=t
                    )
                    t
                )
            )
        )
    )
    

    Regards,

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
Children
  • RAGHU2634
    RAGHU2634 over 7 years ago in reply to Andrew Beckett

    Hi Andrew,

    Thank you so much Andrew.This is what i exactly wanted.

    Regards,

    Raghu

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information