unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
Subject: srfi-1 delete proc arg order
Date: Sat, 10 May 2003 13:59:19 +1000	[thread overview]
Message-ID: <87issjqwo8.fsf@zip.com.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 510 bytes --]

I noticed the srfi-1 spec says delete and delete! call their predicate
(proc x e[i]), but srfi/srfi-1.scm has it the other way around.

The spec gives an example (delete 5 lst <) to remove all elements
greater than 5 from lst, which doesn't work with the present code.

Unless anyone knows a reason for this difference I'd suggest for head
and stable,

        * srfi-1.scm (delete): Fix predicate arg order to match srfi-1 spec.

        * tests/srfi-1.test (delete, delete!): Test predicate call arg order.


[-- Attachment #2: srfi-1.scm.delete-args.diff --]
[-- Type: text/plain, Size: 279 bytes --]

--- srfi-1.scm.~1.23.~	2003-05-05 11:23:36.000000000 +1000
+++ srfi-1.scm	2003-05-10 13:29:01.000000000 +1000
@@ -802,7 +802,7 @@
     (let lp ((l list))
       (if (null? l)
 	'()
-	(if (l= (car l) x)
+	(if (l= x (car l))
 	  (lp (cdr l))
 	  (cons (car l) (lp (cdr l))))))))
 

[-- Attachment #3: srfi-1.test.delete-args.diff --]
[-- Type: text/plain, Size: 464 bytes --]

--- srfi-1.test.~1.1.~	2003-05-05 11:17:32.000000000 +1000
+++ srfi-1.test	2003-05-10 13:23:01.000000000 +1000
@@ -22,6 +22,22 @@
 
 
 ;;
+;; delete and delete!
+;;
+
+(let ()	
+  (define (common-tests delete-proc)
+    (pass-if "called arg order"
+      (equal? '(1 2 3)
+	      (delete-proc 3 '(1 2 3 4 5) <))))
+  
+  (with-test-prefix "delete"
+    (common-tests delete))
+    
+  (with-test-prefix "delete!"
+    (common-tests delete!)))
+
+;;
 ;; drop
 ;;
 

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

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

             reply	other threads:[~2003-05-10  3:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-10  3:59 Kevin Ryde [this message]
2003-05-12 23:03 ` srfi-1 delete proc arg order Kevin Ryde
2003-05-12 23:49   ` Rob Browning
2003-05-13 17:44     ` Marius Vollmer
2003-05-16  1:06       ` Kevin Ryde
2003-05-16  2:26         ` Rob Browning
2003-05-16 23:37           ` Kevin Ryde
2003-05-17  0:06             ` Rob Browning

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=87issjqwo8.fsf@zip.com.au \
    --to=user42@zip.com.au \
    /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).