1. ## add tow list in one list

Registered forum members do not see this ad.

Hello everybody,
i have tow list :
list1 = (x1 x2 x3 x4 x5 x6 x7 .....)
list 2 =(y1 y2 y3 y4 y5 y6 y7 .....)
and i want to convert tow list to :
list = ((x1 y1)(x2 y2)(x3 y3)(x4 y4)(x5 y5) .....)

how can i do this??

2. Code:
`(mapcar '(lambda (r j) (list r j)) '(x1 x2 x3 x4 x5 x6 x7) '(y1 y2 y3 y4 y5 y6 y7))`

3. thank you ronjonp, But it may be more than x7 and y7 ,,,,and I know that the number of two lists is equal,,I entered these codes but i get error :

(mapcar '(lambda (r j) (list r j)) '(list1) '(list2))

4. Originally Posted by amir0914
thank you ronjonp, But it may be more than x7 and y7 ,,,,and I know that the number of two lists is equal,,I entered these codes but i get error :

(mapcar '(lambda (r j) (list r j)) '(list1) '(list2))
Take the ' off of your lists.
Code:
```(setq list1 '("A" "B" "C" "D" "E" "F")
list2 '(1 2 3 4 5 6)
)
(mapcar '(lambda (r j) (list r j)) list1 list2)```

5. Thank you very much ronjonp, great, my problem has been resolved
excuse me for my poor english.

6. Originally Posted by amir0914
Thank you very much ronjonp, great, my problem has been resolved
excuse me for my poor english.

7. It could be reduced to:
Code:
```(setq list1 '("A" "B" "C" "D" "E" "F")
list2 '(1 2 3 4 5 6)
)
(mapcar 'list list1 list2)```

8. Everytime I use (mapcar 'list ... ) in my code it reminds me of Lee, since the guide he gave me.

9. Originally Posted by Lee Mac
It could be reduced to:
Code:
```(setq list1 '("A" "B" "C" "D" "E" "F")
list2 '(1 2 3 4 5 6)
)
(mapcar 'list list1 list2)```
thank you lee mac, Your code is brief and perfect.

10. Registered forum members do not see this ad.

Originally Posted by Lee Mac
It could be reduced to:
Code:
```(setq list1 '("A" "B" "C" "D" "E" "F")
list2 '(1 2 3 4 5 6)
)
(mapcar 'list list1 list2)```
I like it!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts