From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] `any' and `every' in `(oop goops util)' Date: Thu, 20 Oct 2005 11:16:37 +0200 Organization: LAAS-CNRS Message-ID: <87psq0pmyy.fsf@laas.fr> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1129805717 15954 80.91.229.2 (20 Oct 2005 10:55:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 20 Oct 2005 10:55:17 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Oct 20 12:55:15 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ESY3L-00085o-9e for guile-devel@m.gmane.org; Thu, 20 Oct 2005 12:53:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ESY3K-0007Je-O6 for guile-devel@m.gmane.org; Thu, 20 Oct 2005 06:53:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ESWb2-0006Sh-IW for guile-devel@gnu.org; Thu, 20 Oct 2005 05:20:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ESWb1-0006SM-Gn for guile-devel@gnu.org; Thu, 20 Oct 2005 05:20:23 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ESWb0-0006Rh-Fe for guile-devel@gnu.org; Thu, 20 Oct 2005 05:20:22 -0400 Original-Received: from [140.93.0.15] (helo=laas.laas.fr) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1ESWb0-0004IL-60 for guile-devel@gnu.org; Thu, 20 Oct 2005 05:20:22 -0400 Original-Received: by laas.laas.fr (8.13.1/8.13.4) with SMTP id j9K9KJxf016397; Thu, 20 Oct 2005 11:20:20 +0200 (CEST) Original-To: guile-devel@gnu.org X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: 29 =?iso-8859-1?Q?Vend=E9miaire?= an 214 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: powerpc-unknown-linux-gnu Mail-Followup-To: guile-devel@gnu.org User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) X-Spam-Score: 0 () X-Scanned-By: MIMEDefang at CNRS-LAAS X-MIME-Autoconverted: from 8bit to quoted-printable by laas.laas.fr id j9K9KJxf016397 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:5328 Archived-At: 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=E8s * 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 @@ =0C =20 (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 ) =20 @@ -28,37 +28,7 @@ ;;; {Utilities} ;;; =20 -(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) =20 (define (mapappend func . args) (if (memv '() args) @@ -67,7 +37,7 @@ (apply mapappend func (map cdr args))))) =20 (define (find-duplicate l) ; find a duplicate in a list; #f otherwise - (cond=20 + (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