• 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 "smash" a list of lists into a single list?

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 1374
  • 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 "smash" a list of lists into a single list?

CADcasualty
CADcasualty over 6 years ago

I use a lot of lengthy awvPlotWaveform commands in my Ocean scripts and I'm constantly wrestling with lists for strips and colors etc. where I'm suffering with out by one counts and other such annoyances. I had made a post previously whereby Andrew Beckett provided me with a way to make a list of repeated elements using:

procedure(RepeatElement(element ntimes)
let((result)
for(i 1 ntimes result=cons(element result))
result
)
)

but now I'm finding myself wanting to make a list made up of a repeated sequences. Say I make a list of colors xx=list(Red Green Blue) - I want to repeat that 8 times so that I end up with a single list containing 24 elements consisting of (Red Green Blue Red Green Blue Red Green Blue ... ). How do I do this?

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 6 years ago

    procedure(RepeatList(theList nTimes)
      let((result)
        for(i 1 nTimes result=append(theList result))
        result
      )
    )

    So RepeatList('(Red Green Blue) 4) gives you:

    (Red Green Blue Red Green
    Blue Red Green Blue Red
    Green Blue
    )

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • CADcasualty
    CADcasualty over 6 years ago in reply to Andrew Beckett

    Thanks that works great! Based on your face-palmingly simple response it's clear that the underlying issue is that I'm a lisp novice and that I didn't know about the append function (although I did try several search attempts before resorting to the forums). Apologies for asking such baby questions (I work in a small startup and nobody here knows lisp very well). Please say so if I'm crossing any line - you're the best support I have around here and the last person I need to tick off...

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 6 years ago in reply to CADcasualty
    CADcasualty said:
    Apologies for asking such baby questions

    No need to apologise - your question was very clearly posed and no effort to answer. I mainly tend to get irritated by poorly asked questions where it takes much longer going back and forth because I have to guess what is being asked. I know not everyone knows SKILL that well (although you don't really need to know LISP to use it), so this all adds to the pool of human knowledge that people can search and find!

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

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