From: ludovic.courtes@laas.fr (Ludovic Courtès)
Subject: [PATCH] `any' and `every' in `(oop goops util)'
Date: Thu, 20 Oct 2005 11:16:37 +0200 [thread overview]
Message-ID: <87psq0pmyy.fsf@laas.fr> (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
next reply other threads:[~2005-10-20 9:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-20 9:16 Ludovic Courtès [this message]
2005-10-20 19:47 ` [PATCH] `any' and `every' in `(oop goops util)' 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87psq0pmyy.fsf@laas.fr \
--to=ludovic.courtes@laas.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).