unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* srfi-1 delete proc arg order
@ 2003-05-10  3:59 Kevin Ryde
  2003-05-12 23:03 ` Kevin Ryde
  0 siblings, 1 reply; 8+ messages in thread
From: Kevin Ryde @ 2003-05-10  3:59 UTC (permalink / 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

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

end of thread, other threads:[~2003-05-17  0:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-10  3:59 srfi-1 delete proc arg order Kevin Ryde
2003-05-12 23:03 ` 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

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).