unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Pierre Lindenbaum <lindenbaum-p@univ-nantes.fr>
To: Simon Tournier <zimon.toutoune@gmail.com>, guile-user@gnu.org
Subject: Re: using guile like a awk filter in a C program.
Date: Tue, 21 May 2024 15:39:58 +0200	[thread overview]
Message-ID: <af24efb8-022c-6029-bee6-0b7e091be402@univ-nantes.fr> (raw)
In-Reply-To: <87v83ce2en.fsf@gmail.com>

Thanks for your answer
>> - is it possible to use guile for such task ? More precisely, can I
>> compile the guile script just once in `my_initialize_guile` and use it
>> in the while loop without having to recompile it.
> I am not sure to well understand.  Since, it could be read two ways:
>
>   + Call Scheme from C

I want to call scheme from C.

The C loop scans the binary data and a scheme script would be used to accept/reject a record. Something like


         ./my-c-program --filter '(and (is-male?) (is-german?) )' persons.data > male_from_germany.data


>> - furthermore, what's the best practice to include the user's script in
>> a larger script that would include the definitions of `variant-is-snp?`
>> , `variant-allele-count`, etc...
> Maybe modules?

right, if I call scheme fro C should I put my library in a directory or is there any way to embed the code in the C executable (in a const char*...)

> What you want to replace is the driver – currently implemented in AWK.
> You would like to have the driver (glue code) in Guile.  Is it correct?

hum not sure .. again, here my program is a C code, and I want to provide a guile program that would be used as a filter for each record.


./my-c-program --filter '(and (is-male?) (is-german?) )' persons.data > male_from_germany.data


I hope it's clearer now


Pierre





  reply	other threads:[~2024-05-21 13:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 13:55 using guile like a awk filter in a C program Pierre LINDENBAUM
2024-05-17 18:09 ` Simon Tournier
2024-05-21 13:39   ` Pierre Lindenbaum [this message]
2024-05-22 10:39     ` Simon Tournier
2024-05-24  7:31     ` Pierre Lindenbaum
2024-05-28  8:42       ` Zelphir Kaltstahl
2024-06-10  9:08       ` Maxime Devos via General Guile related discussions
2024-05-21 14:58 ` Basile Starynkevitch
2024-05-30  7:50 ` Pjotr Prins

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=af24efb8-022c-6029-bee6-0b7e091be402@univ-nantes.fr \
    --to=lindenbaum-p@univ-nantes.fr \
    --cc=guile-user@gnu.org \
    --cc=zimon.toutoune@gmail.com \
    /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).