unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] `any' and `every' in `(oop goops util)'
@ 2005-10-20  9:16 Ludovic Courtès
  2005-10-20 19:47 ` Kevin Ryde
  0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2005-10-20  9:16 UTC (permalink / raw)


Hi,

The `(oop goops util)' module currently exports its own version of `any' and
`every', which is unnecessary and causes warnings to be issued when
`(srfi srfi-1)' is being used.  The patch below fixes this.

Thanks,
Ludovic.


2005-10-20  Ludovic Courtès  <ludovic.courtes@laas.fr>

	* oop/goops/util.scm: Don't export custom versions of `any' and
	  `every'; re-export those of `(srfi srfi-1)' instead.


--- orig/oop/goops/util.scm
+++ mod/oop/goops/util.scm
@@ -17,9 +17,9 @@
 \f
 
 (define-module (oop goops util)
-  :export (any every
-	   mapappend find-duplicate top-level-env top-level-env?
+  :export (mapappend find-duplicate top-level-env top-level-env?
 	   map* for-each* length* improper->proper)
+  :use-module (srfi srfi-1)
   :no-backtrace
   )
 
@@ -28,37 +28,7 @@
 ;;; {Utilities}
 ;;;
 
-(define (any pred lst . rest)
-  (if (null? rest) ;fast path
-      (and (not (null? lst))
-           (let loop ((head (car lst)) (tail (cdr lst)))
-             (if (null? tail)
-                 (pred head)
-                 (or (pred head)
-                     (loop (car tail) (cdr tail))))))
-      (let ((lsts (cons lst rest)))
-        (and (not (any null? lsts))
-             (let loop ((heads (map car lsts)) (tails (map cdr lsts)))
-               (if (any null? tails)
-                   (apply pred heads)
-                   (or (apply pred heads)
-                       (loop (map car tails) (map cdr tails)))))))))
-
-(define (every pred lst . rest)
-  (if (null? rest) ;fast path
-      (or (null? lst)
-          (let loop ((head (car lst)) (tail (cdr lst)))
-            (if (null? tail)
-                (pred head)
-                (and (pred head)
-                     (loop (car tail) (cdr tail))))))
-      (let ((lsts (cons lst rest)))
-        (or (any null? lsts)
-            (let loop ((heads (map car lsts)) (tails (map cdr lsts)))
-              (if (any null? tails)
-                  (apply pred heads)
-                  (and (apply pred heads)
-                       (loop (map car tails) (map cdr tails)))))))))
+(re-export any every)
 
 (define (mapappend func . args)
   (if (memv '()  args)
@@ -67,7 +37,7 @@
 	      (apply mapappend func (map cdr args)))))
 
 (define (find-duplicate l)	; find a duplicate in a list; #f otherwise
-  (cond 
+  (cond
     ((null? l)			#f)
     ((memv (car l) (cdr l))	(car l))
     (else 			(find-duplicate (cdr l)))))



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-12-08  7:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-20  9:16 [PATCH] `any' and `every' in `(oop goops util)' Ludovic Courtès
2005-10-20 19:47 ` Kevin Ryde
2005-10-21  7:54   ` Ludovic Courtès
2005-10-21 20:38     ` Kevin Ryde
2005-10-24  7:45       ` Ludovic Courtès
2005-12-06 23:11   ` Marius Vollmer
2005-12-07  9:59     ` Ludovic Courtès
2005-12-07 19:41       ` Neil Jerram
2005-12-08  7:51         ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).