• 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 do you take the cdr of a tconc list?

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 142
  • Views 14647
  • 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 do you take the cdr of a tconc list?

dmay
dmay over 16 years ago

I am trying to do some efficient list processing and would like to use a tconc list. I need to build my list in the order that I find objects, so I cannot use the cons command. This list will grow quite large and as it is growing, I have a while loop processing the data on the front of the list. In the middle of the while loop, many items can be added to the end of the list. I can use the tconc command to efficiently add items to the end of the tconc list, but each time through the while loop, I want to remove the first item from the list with cdr. I don't know how to do this efficiently with a tconc list.

There is a nice description of how tconc works on Sourcelink: sourcelink.cadence.com/.../11001694.html

However, as you can see, the tconc structure is a list that contains your list and a pointer to the last item in your list. If you want to create a tconc list by other means, you would need to do it this way (note: lconc is the same as tconc, except lconc appends a list to the end of your list and tconc appends one item to the end of your list):

a=list(1 2 3 4)
a=cons(a last(a)) => ((1 2 3 4) 4)
OR this way:
a=list(1 2 3 4)
a=lconc(nil a) => ((1 2 3 4) 4)

First, I could take the cdr of the car of my tconc list, then I could use one of the above approaches to rebuild my tconc list. However, I think it would be expensive since last must traverse to the end of the list. Likewise, I assume that lconc has the same overhead.

Anyone have any ideas?

Derek

  • Cancel
Parents
  • dmay
    dmay over 16 years ago

    Tongju,

    I like your thinking! I tried that in my simple testcase and was able to run in 0.12 seconds instead of 22 seconds. I don't think the memory is an issue since the tconc list will be freed when the routine finishes. I'll try it in my original code.

     Thanks!
    Derek

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • dmay
    dmay over 16 years ago

    Tongju,

    I like your thinking! I tried that in my simple testcase and was able to run in 0.12 seconds instead of 22 seconds. I don't think the memory is an issue since the tconc list will be freed when the routine finishes. I'll try it in my original code.

     Thanks!
    Derek

    • 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