unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* How to convert from Emacs Lisp to Guile
@ 2010-06-18  8:48 Cecil Westerhof
  2010-06-18 15:07 ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Cecil Westerhof @ 2010-06-18  8:48 UTC (permalink / raw)
  To: guile-user

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-06-20 19:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-18  8:48 How to convert from Emacs Lisp to Guile Cecil Westerhof
2010-06-18 15:07 ` Ludovic Courtès
2010-06-18 17:19   ` Thien-Thi Nguyen
2010-06-20 14:03     ` Ludovic Courtès
2010-06-20 17:51       ` Thien-Thi Nguyen
2010-06-20 19:06         ` Ludovic Courtès
2010-06-20 19:33           ` Thien-Thi Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).