close
Warning:
Can't synchronize with repository "(default)" (The repository directory has changed, you should resynchronize the repository with: trac-admin $ENV repository resync '(default)'). Look in the Trac log for more information.
Line | |
---|
1 | (defun slow-add (p q order-fn add-fn)
|
---|
2 | (cond
|
---|
3 | ((endp p) q)
|
---|
4 | ((endp q) p)
|
---|
5 | (t
|
---|
6 | (multiple-value-bind
|
---|
7 | (greater-p equal-p)
|
---|
8 | (funcall order-fn (car p) (car q))
|
---|
9 | (cond
|
---|
10 | (greater-p ; (> (car p) (car q))
|
---|
11 | (cons (car p) (slow-add (cdr p) q order-fn add-fn))
|
---|
12 | )
|
---|
13 | (equal-p ; (= (car p)) (car q))
|
---|
14 | (let ((s (funcall add-fn (lc p) (lc q))))
|
---|
15 | (cond
|
---|
16 | ((universal-zerop s)
|
---|
17 | (slow-add (cdr p) (cdr q) order-fn add-fn))
|
---|
18 | (t
|
---|
19 | ;; Adjust the lc of p
|
---|
20 | (setf (lc p) s)
|
---|
21 | (cons (car p) (slow-add (cdr p) (cdr q) order-fn add-fn))
|
---|
22 | ))))
|
---|
23 | (t ;(< (car p) (car q))
|
---|
24 | (cons (car q) (slow-add p (cdr q) order-fn add-fn))
|
---|
25 | ))))))
|
---|
Note:
See
TracBrowser
for help on using the repository browser.
Download in other formats: