• 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 simultaneously traverse varaiable number of lists...

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 142
  • Views 15064
  • 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 simultaneously traverse varaiable number of lists?

archive
archive over 19 years ago

If I want to traverse, lets's say for example, 3 lists at one time, I would use:

list1 = '(1 2 3)
list2 = '(4 5 6)
list3 = '(7 8 9)
foreach((x y z) list1 list2 list3
printf("%L %L %L\n" x y z)
)
But, how do you do this, when you don't know how many lists that you will need to traverse? Is this easily done in SKILL? Or, will I have to brute force it using elemental list access, like so?
listOfLists = '((1 2 3) (4 5 6) (7 8 9))
for(j 1 length(car(listOfLists))
string = ""
foreach(l listOfLists
string = sprintf(nil "%s %L" string nthelem(j l))
)
printf("%s\n" string)
)
Do you know a better way?  Please remember that I do not know the number of lists in the listOfLists a priori (although I do know the lists are all the same length); otherwise, I would use the structure from the first example ...

Thanks!


Originally posted in cdnusers.org by m27315
  • Cancel
Parents
  • archive
    archive over 19 years ago

    Posted By adbeckett on 5/26/2006 11:02 AM
    The best thing here would be to use mapc and apply, as follows ... The backquote is being used as a readable way of building the arguments to the mapc - which would be a function object (created with lambda in this case) and the rest of the arguments which would be the list members of listOfLists. You could have just used cons instead ... They do the same thing - but backquote tends to be used more with macros, for example.
    Do you think there are any performance penalties/advantages associated with any of these techniques for large lists and more complex lambda functions?


    Originally posted in cdnusers.org by m27315
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • archive
    archive over 19 years ago

    Posted By adbeckett on 5/26/2006 11:02 AM
    The best thing here would be to use mapc and apply, as follows ... The backquote is being used as a readable way of building the arguments to the mapc - which would be a function object (created with lambda in this case) and the rest of the arguments which would be the list members of listOfLists. You could have just used cons instead ... They do the same thing - but backquote tends to be used more with macros, for example.
    Do you think there are any performance penalties/advantages associated with any of these techniques for large lists and more complex lambda functions?


    Originally posted in cdnusers.org by m27315
    • 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