No need to repeat member/assoc here

This commit is contained in:
Justin Ethier 2016-08-19 23:20:31 -04:00
parent 93b855b22c
commit 970c10d177

View file

@ -1222,10 +1222,10 @@
(filter! (lambda (y) (not (= x y))) lis))) (filter! (lambda (y) (not (= x y))) lis)))
;;; Extended from R4RS to take an optional comparison argument. ;;; Extended from R4RS to take an optional comparison argument.
(define (member x lis . maybe-=) ;;(define (member x lis . maybe-=)
(let ((= (:optional maybe-= equal?))) ;; (let ((= (:optional maybe-= equal?)))
(find-tail (lambda (y) (= x y)) lis))) ;; (find-tail (lambda (y) (= x y)) lis)))
;;
;;; R4RS, hence we don't bother to define. ;;; R4RS, hence we don't bother to define.
;;; The MEMBER and then FIND-TAIL call should definitely ;;; The MEMBER and then FIND-TAIL call should definitely
;;; be inlined for MEMQ & MEMV. ;;; be inlined for MEMQ & MEMV.
@ -1267,9 +1267,9 @@
;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;
;;; Extended from R4RS to take an optional comparison argument. ;;; Extended from R4RS to take an optional comparison argument.
(define (assoc x lis . maybe-=) ;;(define (assoc x lis . maybe-=)
(let ((= (:optional maybe-= equal?))) ;; (let ((= (:optional maybe-= equal?)))
(find (lambda (entry) (= x (car entry))) lis))) ;; (find (lambda (entry) (= x (car entry))) lis)))
(define (alist-cons key datum alist) (cons (cons key datum) alist)) (define (alist-cons key datum alist) (cons (cons key datum) alist))