GOOPS utils module cleanups
authorAndy Wingo <wingo@pobox.com>
Mon, 12 Jan 2015 20:40:29 +0000 (21:40 +0100)
committerAndy Wingo <wingo@pobox.com>
Fri, 23 Jan 2015 15:16:02 +0000 (16:16 +0100)
* module/oop/goops.scm (make-class): Inline find-duplicate to its use
  site.

* module/oop/goops/util.scm (improper->proper): Remove unused function.
  (any, every): Don't re-export these from SRFI-1; users can get them
  from SRFI-1 directly.

module/oop/goops.scm
module/oop/goops/util.scm

index 543acff..64c3d11 100644 (file)
@@ -1183,6 +1183,14 @@ followed by its associated value.  If @var{l} does not hold a value for
 ;;;
 
 (define (make-class supers slots . options)
+  (define (find-duplicate l)
+    (match l
+      (() #f)
+      ((head . tail)
+       (if (memq head tail)
+           head
+           (find-duplicate tail)))))
+
   (let* ((name (get-keyword #:name options (make-unbound)))
          (supers (if (not (or-map (lambda (class)
                                     (memq <object>
index fa48645..8b48f98 100644 (file)
 \f
 
 (define-module (oop goops util)
-  :export (find-duplicate
-          map* for-each* length* improper->proper)
-  :use-module (srfi srfi-1)
-  :re-export  (any every)
-  :no-backtrace
-  )
-
+  #:export (map* for-each* length*))
 
 ;;;
 ;;; {Utilities}
 ;;;
 
-(define (find-duplicate l)     ; find a duplicate in a list; #f otherwise
-  (cond 
-    ((null? l)                 #f)
-    ((memv (car l) (cdr l))    (car l))
-    (else                      (find-duplicate (cdr l)))))
-
 (define (map* fn . l)          ; A map which accepts dotted lists (arg lists  
   (cond                        ; must be "isomorph"
    ((null? (car l)) '())
@@ -52,8 +40,3 @@
   (do ((n 0 (+ 1 n))
        (ls ls (cdr ls)))
       ((not (pair? ls)) n)))
-
-(define (improper->proper ls)
-  (if (pair? ls)
-      (cons (car ls) (improper->proper (cdr ls)))
-      (list ls)))