From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: doc list-matches, fold-matches Date: Tue, 19 Apr 2005 08:15:15 +1000 Message-ID: <87pswrpw98.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1113863030 13589 80.91.229.2 (18 Apr 2005 22:23:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 18 Apr 2005 22:23:50 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Apr 19 00:23:47 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DNedu-0000Uv-0C for guile-devel@m.gmane.org; Tue, 19 Apr 2005 00:22:58 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DNei5-0005XS-OW for guile-devel@m.gmane.org; Mon, 18 Apr 2005 18:27:17 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DNehj-0005RF-Qi for guile-devel@gnu.org; Mon, 18 Apr 2005 18:26:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DNehh-0005QZ-TS for guile-devel@gnu.org; Mon, 18 Apr 2005 18:26:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DNehh-0003p9-Oq for guile-devel@gnu.org; Mon, 18 Apr 2005 18:26:53 -0400 Original-Received: from [61.8.0.85] (helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DNeYn-0001Cd-Ky for guile-devel@gnu.org; Mon, 18 Apr 2005 18:17:42 -0400 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 j3IMFYml014021 for ; Tue, 19 Apr 2005 08:15:34 +1000 Original-Received: from localhost (ppp2FCA.dyn.pacific.net.au [61.8.47.202]) by mailproxy2.pacific.net.au (8.12.3/8.12.3/Debian-7.1) with ESMTP id j3IMFX0H000331 for ; Tue, 19 Apr 2005 08:15:33 +1000 Original-Received: from gg by localhost with local (Exim 3.36 #1 (Debian)) id 1DNeWR-0000it-00; Tue, 19 Apr 2005 08:15:15 +1000 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: news.gmane.org gmane.lisp.guile.devel:4905 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:4905 list-matches and fold-matches in ice-9 regexp are exported but not documented. They look pretty useful, I think I'll add some words about them. (And I think I'll try to clarify how you ask for both regexp/notbol and regexp/noteol in the regexp-exec flags. They're a logior if I'm not mistaken.) -- Scheme Procedure: list-matches regexp str [flags] Return a list of match structures which are the non-overlapping matches of REGEXP in STR. REGEXP can be either a string pattern or a compiled regexp. FLAGS is as per `regexp-exec' above. (map match:substring (list-matches "[a-z]+" "abc 42 def 78")) => ("abc" "def") -- Scheme Procedure: fold-matches regexp str init proc [flags] Apply PROC to the non-overlapping matches of REGEXP in STR to build a result. REGEXP can be either a string pattern or a compiled regexp. FLAGS is as per `regexp-exec' above. PROC is called as `(PROC match prev)' where MATCH is a match structure and PREV is the previous return from PROC. For the first call PREV is the given INIT parameter. The final return from PROC is the return from `fold-matches'. For example to count matches, (fold-matches "[a-z][0-9]" "abc x1 def y2" 0 (lambda (m count) (1+ count))) => 2 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel