• 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. Remove double quotes from each element of list A

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 143
  • Views 18021
  • 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

Remove double quotes from each element of list A

Leonardo Vinci
Leonardo Vinci over 7 years ago

I have a list(say, A), of 300 elements like below: 

A=( 

("a" "b")

("c" "d")

("e" "f")

("g" "h")

...

...

...

)

Like above, i have 300 elements, where 1st element is ("a" "b"). 

I want to create a list A without ""(double quotes), like shown below: 

A=( 

(a b)

(c d)

(e f)

(g h)

...

...

...

)

How can i do this? 

Thanks,

LEO

 

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago

    Leo,

    Assuming you really want to convert them all to symbols (not sure why you need to do that, but assume you have a good reason), you'd do:

    foreach(mapcar sublist A mapcar('stringToSymbol sublist))

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Leonardo Vinci
    Leonardo Vinci over 7 years ago in reply to Andrew Beckett

    Hi Andrew, 

    i don't understand how it works, 1st mapcar requires two parameters right? 

    i understand this:

    foreach(sublist A mapcar('stringToSymbol sublist))

    that is, for each sublist in A, do mapcar.  


    But i dont what you have done. 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to Leonardo Vinci

    If you do an ordinary foreach, it will iterate over the outer list, but the return value will just be the original list, and the inner mapcar results will get lost. The foreach function allows the name of a mapping function to be passed as the first argument before the loop variable, and in essence it's a convenient (to some people more readable) version of:

    mapcar(lambda((sublist) mapcar('stringToSymbol sublist)) A)

    In essence that's what it gets converted to - an anonymous function (lambda) is constructed from the loop variable and the body of the foreach, and then this lambda is applied to each element in the list A; the inner mapcar is then applied to each sublist to do the actual conversion from strings to symbols.

    Is that clearer?

    Regards,

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Leonardo Vinci
    Leonardo Vinci over 7 years ago in reply to Andrew Beckett

    Yes, i understood the other way of writing, which you wrote. Thanks! :-)

    • 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