Skip to content

Commit

Permalink
difference is to diff as assoc is to assq
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Moon committed Jun 4, 2014
1 parent 6cedc54 commit 5bba56d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/utils.scm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
((memq (car s1) s2) (diff (cdr s1) s2))
(else (cons (car s1) (diff (cdr s1) s2)))))

(define (difference s1 s2)
(cond ((null? s1) '())
((member (car s1) s2) (diff (cdr s1) s2))
(else (cons (car s1) (diff (cdr s1) s2)))))

(define (unique lst) (delete-duplicates lst))

(define (has-dups lst)
Expand Down

0 comments on commit 5bba56d

Please sign in to comment.