• 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. Map functions

Stats

  • Replies 4
  • Subscribers 159
  • Views 13521
  • Members are here 0
More Content

Map functions

aCraig
aCraig over 16 years ago

Has anybody had trouble nesting map functions? Or is it even valid to do so? I'm running APD L 16.01.

This code works fine to create a flat list to the children of a net.

children =  mapcar(lambda((b) b->children) net->branches))

children =  mapcan(lambda((c) c) children)

 

if I try to nest the two it hangs the tool.

children =  mapcan(lambda((c) c) mapcar(lambda((b) b->children) net->branches))

  • Sign in to reply
  • Cancel
  • eDave
    eDave over 16 years ago

    The following code works in Allegro:

     mapcan(lambda((c) c) mapcar(lambda((b) car(b)) '(((1 2) 3)((4 5) 6)((7 8) 9))))

    It returns (1 2 4 5 7 8) as predicted.

    Your nested net function also works in Allegro 16.2.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • aCraig
    aCraig over 16 years ago

    eDave said:

     mapcan(lambda((c) c) mapcar(lambda((b) car(b)) '(((1 2) 3)((4 5) 6)((7 8) 9))))

     

    Dave, this works for me as well.

    I'm not sure what's going on. If I select a net with more then 1 branch and then execute the command it runs fine the first time. If I execute it a second time it locks up APD. If I select a net with only 1 branch it runs multiple times, no problem.  

     EDIT: behaves the same way in Allegro 16.01 XL

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • eDave
    eDave over 16 years ago

    Oh yes.

    I see the same thing in Allegro with a multi-branch net but not with the above example.

    I'm not sure what would cause this.

    Dave

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • aCraig
    aCraig over 16 years ago

    So I believe I've figured out what the heck is going on (although it doesn't make sense)!

    Using Dave's example (broken down):

    mylist =  '(((1 2) 3)((4 5) 6)((7 8) 9))

    newlist = mapcar(lambda((b) car(b)) mylist)

    At this point:

    mylist =  '(((1 2) 3)((4 5) 6)((7 8) 9)); this is correct

    newlist = '((1 2) (4 5) (7 8)); this is correct

    All is good until:

    flatlist = mapcan(lambda((c) c) newlist)

    flatlist = '(1 2 4 5 7 8); this is correct

    newlist = '(((1 2 4 5 7 8) (4 5 7 8)  (7 8)); I beleive this is correct since mapcan uses the destructive function nconc.

    mylist = '(((1 2 4 5 7 8) 3) ((4 5 7 8) 6) ((7 8) 9)); this is what's confusing. why has mylist been modified??

     

    This brings me to my original problem:

    children =  mapcan(lambda((c) c) mapcar(lambda((b) b->children) net->branches))

    This command is actually destructively replacing the children in the net branch structure. This is the reason, I believe, the tool is hanging. The next time you try to access the net dbid structure everything is out of wack. The bad structure is not saved when you save the design, luckily.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
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