From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Cecil Westerhof Newsgroups: gmane.lisp.guile.user Subject: How to convert from Emacs Lisp to Guile Date: Fri, 18 Jun 2010 10:48:32 +0200 Organization: Decebal Computing Message-ID: <87iq5gn2u7.fsf@linux-lqcw.site> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1276850900 3004 80.91.229.12 (18 Jun 2010 08:48:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 18 Jun 2010 08:48:20 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Jun 18 10:48:14 2010 connect(): No such file or directory Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OPXFD-0000fA-7f for guile-user@m.gmane.org; Fri, 18 Jun 2010 10:48:11 +0200 Original-Received: from localhost ([127.0.0.1]:44446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPXFC-0007cw-EI for guile-user@m.gmane.org; Fri, 18 Jun 2010 04:48:10 -0400 Original-Received: from [140.186.70.92] (port=55114 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPXF2-0007a7-AD for guile-user@gnu.org; Fri, 18 Jun 2010 04:48:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OPXF0-0002Eb-E2 for guile-user@gnu.org; Fri, 18 Jun 2010 04:48:00 -0400 Original-Received: from smtp-vbr13.xs4all.nl ([194.109.24.33]:2960) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OPXF0-0002E9-6W for guile-user@gnu.org; Fri, 18 Jun 2010 04:47:58 -0400 Original-Received: from linux-lqcw.site (84-53-123-169.wxdsl.nl [84.53.123.169]) by smtp-vbr13.xs4all.nl (8.13.8/8.13.8) with ESMTP id o5I8ls3H027033 for ; Fri, 18 Jun 2010 10:47:55 +0200 (CEST) (envelope-from Cecil@decebal.nl) X-Homepage: http://www.decebal.nl/ User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7888 Archived-At: At the moment I have the following code in Emacs Lisp: (defun substitute-expression(input-file output-file reg-exp substitute-str) (let ((match-length)) (switch-to-buffer (find-file-noselect input-file t t)) (buffer-disable-undo) (while (re-search-forward reg-exp nil t) (setq match-length (- (point) (match-beginning 0))) (while (> match-length (length substitute-str)) (setq substitute-str (concat substitute-str substitute-str))) (replace-match (substring substitute-str 0 match-length)) ) (write-region (point-min) (point-max) output-file))) To get my first taste of writing in Guile (and evaluating if changing to Guile is worthwhile) I was wondering how to do the same in Guile. Also I use: (byte-compile '"'"'substitute-expression) This compiles the function before it is executed, which speeds things considerable up. Is this also possible with Guile? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof