• 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. how to get depth of list

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 143
  • Views 14935
  • 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

how to get depth of list

lawlag02
lawlag02 over 13 years ago

Hi evreyone

does anyone here knows how to get depth of list by SKILL in a very simplistic way. let's say a flat list depth = 0, then if i have something like

A = (((1 2 3) 4 5) 6 7 8 )

this should give me depth of A = 2

many thanks in advance for any solution

 BR  law

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    The difference between +1 and add1() is miniscule (in fact from a quick profile I just did with 100 million adds, it made a difference of less than 2 seconds, and in fact add1() was slower - but I didn't check to ensure it was statistically significant, but it wouldn't be worth worrying about for efficiency because the difference is so tiny.

    However, the approach you have taken (which is a very "SCHEME" way of doing things), whilst simple, does suffer from the fact that the extreme use of recursion will mean you are much more likely to hit SKILL's stack limit:

    I ran with a list with 10000 elements in it, and I get:

    *Error* unknown: Runtime Stack Overflow!!!

    In my approach, I was only using recursion for the actually nested hierarchy of the list, not the length of the list. Mapping (i.e. foreach) doesn't have this problem.

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    The difference between +1 and add1() is miniscule (in fact from a quick profile I just did with 100 million adds, it made a difference of less than 2 seconds, and in fact add1() was slower - but I didn't check to ensure it was statistically significant, but it wouldn't be worth worrying about for efficiency because the difference is so tiny.

    However, the approach you have taken (which is a very "SCHEME" way of doing things), whilst simple, does suffer from the fact that the extreme use of recursion will mean you are much more likely to hit SKILL's stack limit:

    I ran with a list with 10000 elements in it, and I get:

    *Error* unknown: Runtime Stack Overflow!!!

    In my approach, I was only using recursion for the actually nested hierarchy of the list, not the length of the list. Mapping (i.e. foreach) doesn't have this problem.

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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