Details |
Last modification |
View Log
| RSS feed
| Rev |
Author |
Line No. |
Line |
| 64 |
irasnyd |
1 |
;;;
|
|
|
2 |
;;; A recursive function which takes two lists of integers and returns
|
|
|
3 |
;;; a list of integers in which each element is the sun of the
|
|
|
4 |
;;; corresponding elements of the incoming lists. The lists are
|
|
|
5 |
;;; not required to be the same length.
|
|
|
6 |
;;;
|
|
|
7 |
;;; Examples:
|
|
|
8 |
;;; (AL1 '(3 1 4) '(8 2 5)) --> (11 3 9)
|
|
|
9 |
;;; (AL1 '(3 1 4) '(2 2)) --> (5 3 4)
|
|
|
10 |
;;; (AL1 '(3 1 4) nil) --> (3 1 4)
|
|
|
11 |
;;;
|
|
|
12 |
(defun AL1 (L1 L2)
|
|
|
13 |
(cond
|
|
|
14 |
((null L1) L2)
|
|
|
15 |
((null L2) L1)
|
|
|
16 |
(t (cons (+ (car L1) (car L2)) (AL1 (cdr L1) (cdr L2))))
|
|
|
17 |
)
|
|
|
18 |
)
|