其中list_a为'(a1 a2 a3 ... ak-1)list_q为(q1 q2 q3 ... qk-1)- (defun Add(list_a list_q / i j sum sum_tmp)
- (setq sum 0)
- (setq i 0)
- (repeat (length list_a)
- (setq sum_tmp 0)
- (setq j 0)
- (repeat (1+ i)
- (setq sum_tmp (+ sum_tmp (nth j list_a)))
- (setq j (1+ j))
- )
- (setq sum (+ sum (* (nth i list_q) sum_tmp)))
- (setq i (1+ i))
- )
- sum
- )
|