Quantcast
Channel: Cadence Custom IC Skill Forum
Viewing all articles
Browse latest Browse all 5205

Nested for loop

$
0
0

A=list(

(1 2)

(6 2)

(8 2) 

(5 2) 

(7 2)

(3 2)

)

B=list(

(8 10)

(3 10)

(1 10) 

(5 10)

(7 10)

(6 10) 

)

I want to have a list C, whose 1st element from A matches the 1st element in B and make a list like the shown below :

C=list(

( (1 2) (1 10) )

( (6 2) (6 10) )

( (8 2) (8 10) )

( (5 2) (5 10) )

( (7 2) (7 10) )

( (3 2) (3 10) )

)

Note that the y elements of sublists of A and list B are 2 and 10 respectively, all same. Also, length of lists A and B are also same.

I have a nested "for" loop and "cons" to achieve C, but for some cases its not working. Can you help me in achieving this?

Maybe we can make use of map functions? mapcar/mapcan?

Thanks,

Leo


Viewing all articles
Browse latest Browse all 5205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>