mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-28 16:00:22 +02:00
(lset-adjoin): Revert change using list' not
acc', the
spec is not quite clear, but reference code uses acc, so do that.
This commit is contained in:
parent
94c442be66
commit
6282d93dba
1 changed files with 7 additions and 1 deletions
|
@ -733,11 +733,17 @@
|
|||
(every (lambda (el) (member el f (lambda (x y) (= y x)))) (car r))
|
||||
(lp (car r) (cdr r)))))))
|
||||
|
||||
;; It's not quite clear if duplicates among the `rest' elements are meant to
|
||||
;; be cast out. The spec says `=' is called as (= lstelem restelem),
|
||||
;; suggesting perhaps not, but the reference implementation shows the "list"
|
||||
;; at each stage as including those elements already added. The latter
|
||||
;; corresponds to what's described for lset-union, so that's what's done.
|
||||
;;
|
||||
(define (lset-adjoin = list . rest)
|
||||
(let lp ((l rest) (acc list))
|
||||
(if (null? l)
|
||||
acc
|
||||
(if (member (car l) list (lambda (x y) (= y x)))
|
||||
(if (member (car l) acc (lambda (x y) (= y x)))
|
||||
(lp (cdr l) acc)
|
||||
(lp (cdr l) (cons (car l) acc))))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue