unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guile-user@gnu.org
Subject: Re: grep and sed in guile
Date: Tue, 27 Aug 2013 17:24:54 +0200	[thread overview]
Message-ID: <CAGua6m3uR50rfR7sMZqRh81sKjsLLB+6WOoQH+JkuaccHowr0g@mail.gmail.com> (raw)
In-Reply-To: <87ioyrjmaw.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1133 bytes --]

Nice!

Also scsh for guile can be used to get grep and sed functionality. The
interesting thing is to try to
design sed/grep like functionality that knows about scheme or C or whatever
format in some clever way.
Usually sad and grep is good enough, but it is an interesting task never
the less. My plan for know is to be able
to stream scheme source file and be able to sed them with an interface that
is close to syntax-parse. That would be
really cool.

Cheers


On Tue, Aug 27, 2013 at 3:27 PM, Ludovic Courtès <ludo@gnu.org> wrote:

> > 3) (sed m expr)
> >
> > This will print out on std output all lines not matched by m, if m is
> > matched then that expr will make sure to print the correct way
> >
> > An example matcher is
> >   m := (s-tr a b)
> >
> > which will replace a by b
>
> FWIW Guix has a sed-like macro, called ‘substitute*’ [0].  Example:
>
>   (substitute* "my-file.txt"
>     (("^(.*) world$" _ first-word)
>      (string-append "Hello (was: " first-word ") world\n")))
>
> Ludo’.
>
> [0]
> http://git.savannah.gnu.org/cgit/guix.git/tree/guix/build/utils.scm#n387
>
>
>

[-- Attachment #2: Type: text/html, Size: 1777 bytes --]

      reply	other threads:[~2013-08-27 15:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-25 21:32 grep and sed in guile Stefan Israelsson Tampe
2013-08-27 13:27 ` Ludovic Courtès
2013-08-27 15:24   ` Stefan Israelsson Tampe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGua6m3uR50rfR7sMZqRh81sKjsLLB+6WOoQH+JkuaccHowr0g@mail.gmail.com \
    --to=stefan.itampe@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).