1. ## Add the two lists

Registered forum members do not see this ad.

Hi, I need a arguments function that sums the two lists.
Example
Code:
`(setq lst1 (list (list 1 2 3 …) (list 2 3 4 …) (list 5 4 3 …) …))`
Code:
`(setq lst2 (list (list 4 4 4 …) (list 1 1 1 …) (list 3 3 3 …)  …))`
Result
Code:
`((5 6 7 …) (3 4 5 …) (8 7 6 …) …)`
Lists are symmetric but have any length.

2. Code:
`(defun f ( l1 l2 ) (mapcar '(lambda ( x y ) (mapcar '+ x y)) l1 l2))`
Code:
```_\$ (f '((1 2 3) (2 3 4) (5 4 3)) '((4 4 4) (1 1 1) (3 3 3)))
((5 6 7) (3 4 5) (8 7 6))```

3. Thank you.

4. Another way, recursive
Code:
```
(defun plus_lists (lst1 lst2 / )
;;FH 2009
(if (and lst1
lst2)
(append (plus_lists (reverse (cdr (reverse lst1)))(reverse (cdr
(reverse lst2))))
(list (mapcar '+ (last lst1) (last
lst2)))
)))))
;;usage :
(setq summlst (plus_lists
lst1 lst2))```

5. Hello everyone...
I need your help.. I need to add the path to a dwg list...
(setq DWG_PATH_lst ("c:/test/")) ;<<<=== my dwg path, is a list also
(setq DWG_List ("a1" "a2")) ;<<<=== my dwg list
the result must be a new list ===>>> ("c:/test/a1" "c:/test/a2")

6. Registered forum members do not see this ad.

got it...
1. Make sure DWG_PATH_lst is a string...

(setq New-DWG_List (mapcar '(lambda ( x ) (strcat DWG_PATH_lst x)) DWG_List))

#### Posting Permissions

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