Subversion Repositories programming

Rev

Rev 100 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
108 ira 1
;Copyright: Ira W. Snyder
2
;Date: 07-11-2005
3
;License: Public Domain
4
 
5
 
64 irasnyd 6
;;;
7
;;; A recursive function which takes two lists of integers and returns
8
;;; a list of integers in which each element is the sun of the
9
;;; corresponding elements of the incoming lists. The lists are
10
;;; not required to be the same length.
11
;;;
12
;;; Examples:
13
;;; (AL1 '(3 1 4) '(8 2 5)) --> (11 3 9)
14
;;; (AL1 '(3 1 4) '(2 2)) --> (5 3 4)
15
;;; (AL1 '(3 1 4) nil) --> (3 1 4)
16
;;;
17
(defun AL1 (L1 L2)
18
  (cond
19
    ((null L1) L2)
20
    ((null L2) L1)
21
    (t         (cons (+ (car L1) (car L2)) (AL1 (cdr L1) (cdr L2))))
22
  )
23
)