• 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. Allegro X PCB Editor
  3. Remove item from list

Stats

  • Replies 5
  • Subscribers 159
  • Views 18713
  • Members are here 0
More Content

Remove item from list

archive
archive over 19 years ago

I'm trying to remove some items which both in two lists.
But the remove command doesn't work.

A='(0 1 2 3 4 5 6 7 8 9)
B='(1 3 5 7 9)
C=nil
foreach(item A
             if(member(item B) then
                C=remove(item A)
               )
            )


why the result is C= (0 1 2 3 4 5 6 7 8) not (0 2 4 6 8)?
how the remove works?

Who can help to tell me the reason or share me a right code to make it true~~
Thanks.


Originally posted in cdnusers.org by leonlee
  • Sign in to reply
  • Cancel
Parents
  • archive
    archive over 19 years ago

    Hi Leon,

    remove is a destructive function so you were correct to use copy.
    Another (faster) method is to use cons, to create a new list, or the slowish following method
    C = setof(item, A, !member(item, B))

    Cheers, Dave


    Originally posted in cdnusers.org by Dave Elder
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • archive
    archive over 19 years ago

    Hi Leon,

    remove is a destructive function so you were correct to use copy.
    Another (faster) method is to use cons, to create a new list, or the slowish following method
    C = setof(item, A, !member(item, B))

    Cheers, Dave


    Originally posted in cdnusers.org by Dave Elder
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
Cadence Guidelines

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