Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix 5_13

It turns out that there's a built in procedure for removing duplicates from lists.
  • Loading branch information...
commit fcbcb885a6191553e9659ef443505cf538e65e9a 1 parent 6aa9f49
@fastred authored
Showing with 1 addition and 5 deletions.
  1. +1 −5 5_13.scm
View
6 5_13.scm
@@ -14,15 +14,11 @@
(else '())))
(define (not-null? x)
(not (null? x)))
-(define (remove-duplicates l)
- (do ((a '() (if (member (car l) a) a (cons (car l) a)))
- (l l (cdr l)))
- ((null? l) (reverse a))))
(define (make-machine ops controller-text)
(let* ((machine (make-new-machine))
(registers-with-dups (filter not-null?
(map extract-register-name controller-text)))
- (register-names (remove-duplicates registers-with-dups)))
+ (register-names (delete-duplicates registers-with-dups)))
(for-each (lambda (register-name)
((machine 'allocate-register) register-name))
register-names)
Please sign in to comment.
Something went wrong with that request. Please try again.