From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: srfi-1 concatenate Date: Sat, 19 Jul 2003 09:53:02 +1000 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87k7af75pd.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1058572594 14755 80.91.224.249 (18 Jul 2003 23:56:34 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 18 Jul 2003 23:56:34 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jul 19 01:56:33 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19df5V-0003pr-00 for ; Sat, 19 Jul 2003 01:56:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19df5h-00034a-0q for guile-devel@m.gmane.org; Fri, 18 Jul 2003 19:56:45 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19df4v-0002Wh-BA for guile-devel@gnu.org; Fri, 18 Jul 2003 19:55:57 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19df49-00028e-6K for guile-devel@gnu.org; Fri, 18 Jul 2003 19:55:09 -0400 Original-Received: from snoopy.pacific.net.au ([61.8.0.36]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19df2L-0000N9-21 for guile-devel@gnu.org; Fri, 18 Jul 2003 19:53:17 -0400 Original-Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.2.228.40]) by snoopy.pacific.net.au (8.12.3/8.12.3/Debian-6.3) with ESMTP id h6INrFZY027112 for ; Sat, 19 Jul 2003 09:53:15 +1000 Original-Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id h6INrFQg016233 for ; Sat, 19 Jul 2003 09:53:15 +1000 (EST) Original-Received: from localhost (ppp29.dyn228.pacific.net.au [203.143.228.29]) by wisma.pacific.net.au (8.12.9/8.12.9) with ESMTP id h6INrDnh021734 for ; Sat, 19 Jul 2003 09:53:14 +1000 (EST) Original-Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 19df28-0000pR-00; Sat, 19 Jul 2003 09:53:04 +1000 Original-To: guile-devel@gnu.org Mail-Copies-To: never User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.2 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2634 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2634 --=-=-= I propose to make a change, * srfi-1.c, srfi-1.h, srfi-1.scm (concatenate, concatenate!): Rewrite using scm_append and scm_append_x. which should be smaller and faster. I think it requires no more than registering the following, since scm_append and scm_append_x don't modify their list argument. SCM_REGISTER_PROC (s_srfi1_concatenate, "concatenate", 1, 0, 0, scm_append); SCM_REGISTER_PROC (s_srfi1_concatenate_x, "concatenate!", 1, 0, 0, scm_append_x); --=-=-= Content-Disposition: attachment; filename=concatenate.test ;; ;; concatenate and concatenate! ;; (let () (define (common-tests concatenate-proc unmodified?) (define (try lstlst want) (let ((lstlst-copy (copy-tree lstlst)) (got (concatenate-proc lstlst))) (if unmodified? (if (not (equal? lstlst lstlst-copy)) (error "input lists modified"))) (equal? got want))) (pass-if-exception "too few args" exception:wrong-num-args (concatenate-proc)) (pass-if-exception "too many args" exception:wrong-num-args (concatenate-proc '() '())) (pass-if "no lists" (try '() '())) (pass-if (try '((1)) '(1))) (pass-if (try '((1 2)) '(1 2))) (pass-if (try '(() (1)) '(1))) (pass-if (try '(() () (1)) '(1))) (pass-if (try '((1) (2)) '(1 2))) (pass-if (try '(() (1 2)) '(1 2))) (pass-if (try '((1) 2) '(1 . 2))) (pass-if (try '((1) (2) 3) '(1 2 . 3))) (pass-if (try '((1) (2) (3 . 4)) '(1 2 3 . 4))) ) (with-test-prefix "concatenate" (common-tests concatenate #t)) (with-test-prefix "concatenate!" (common-tests concatenate! #f)) ) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel --=-=-=--