;;;  Vector addition in LISP
;;;  File:  VectorAdd.lsp

(setq fn "C:/Temp/VectorAdd.lsp") (terpri)

;;;  -------------------------------------------------------------

(defun vectorAdd (x y)
    (let ((z nil) n)
         (setq n (min (list-length x)
                      (list-length y) ))
         (dotimes (j n (reverse z))
             (setq z (cons (+ (nth j x) (nth j y)) z)) )))

(setq a '(1 2 3 4 5))

(setq b '(10 20 30 40))

(print a)
(print b)
(terpri)

(print (vectorAdd a b))
