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-13 string-any tail call Date: Tue, 07 Dec 2004 08:08:23 +1100 Message-ID: <871xe3yw1k.fsf@zip.com.au> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1102367342 11551 80.91.229.6 (6 Dec 2004 21:09:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 6 Dec 2004 21:09:02 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Dec 06 22:08:59 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CbQ6N-000439-00 for ; Mon, 06 Dec 2004 22:08:59 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CbQG7-0002EJ-LP for guile-devel@m.gmane.org; Mon, 06 Dec 2004 16:19:03 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CbQG3-0002E5-8x for guile-devel@gnu.org; Mon, 06 Dec 2004 16:18:59 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CbQG1-0002DT-UR for guile-devel@gnu.org; Mon, 06 Dec 2004 16:18:58 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CbQG1-0002DQ-KF for guile-devel@gnu.org; Mon, 06 Dec 2004 16:18:57 -0500 Original-Received: from [61.8.0.85] (helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CbQ5v-00061z-7x for guile-devel@gnu.org; Mon, 06 Dec 2004 16:08:31 -0500 Original-Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.0.87]) by mailout2.pacific.net.au (8.12.3/8.12.3/Debian-7.1) with ESMTP id iB6L8TKP002873 for ; Tue, 7 Dec 2004 08:08:29 +1100 Original-Received: from localhost (ppp29E1.dyn.pacific.net.au [61.8.41.225]) by mailproxy2.pacific.net.au (8.12.3/8.12.3/Debian-7.1) with ESMTP id iB6L8S7L012375 for ; Tue, 7 Dec 2004 08:08:29 +1100 Original-Received: from gg by localhost with local (Exim 3.36 #1 (Debian)) id 1CbQ5n-0000fg-00; Tue, 07 Dec 2004 08:08:23 +1100 Original-To: guile-devel@gnu.org Mail-Copies-To: never User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) 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: main.gmane.org gmane.lisp.guile.devel:4476 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:4476 I'm thinking of the following wrapper around the string-any C code to get a tail call on the last pred test, per the srfi-13 spec. It's not too pretty, but at least it'll be right. I guess in the head it could tie into eval now that string-any is in the core. (define (string-any char_pred s . rest) (let ((start (if (null? rest) 0 (car rest))) (end (if (or (null? rest) (null? (cdr rest))) (string-length s) (cadr rest)))) (if (and (procedure? char_pred) (> end start) (<= end (string-length s))) ;; let c-code handle range error (or (string-any-c-code char_pred s start (1- end)) (char_pred (string-ref s (1- end)))) (string-any-c-code char_pred s start end)))) _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel