[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to convert from Emacs Lisp to Guile

From: Cecil Westerhof
Subject: How to convert from Emacs Lisp to Guile
Date: Fri, 18 Jun 2010 10:48:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

At the moment I have the following code in Emacs Lisp:
      (defun substitute-expression(input-file output-file reg-exp 
        (let ((match-length))
          (switch-to-buffer (find-file-noselect input-file t t))
          (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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]