[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Embedding guile in a C application.
From: |
Binesh Bannerjee |
Subject: |
Embedding guile in a C application. |
Date: |
Sun, 30 May 2004 02:32:56 -0400 (EDT) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi...
I'm looking to code a genetic programming system a-la Koza (
http://www.geneticprogramming.com/Tutorial/ )...
I'd like to embed a Guile interpreter inside the app,
and have the C program generate Guile functions, and then get interpreted
with Guile... I'm not sure how to go about doing this, and I haven't found
any clear directions how to do so... (Although, I _have_ found hints that it
should be possible.) http://www.swig.org/Doc1.3/Guile.html shows me
how to embed guile... But, I don't think that's exactly what I want.
What it does, is create a whole guile interpreter shell and all...
All's I want is (something like) this:
int main(int argc,char *argv[]) {
guile_interpreter gi = create_guile_interpreter();
/* c = (define f (lambda (x) (+ 1 x))); */
cons c = new list_struct();
c->add("define");
c->add("f");
cons c2 = new list_struct();
c2->add("lambda");
const c3 = new list_struct();
c3->add("x");
c2->add_list(c3);
const c4 = new list_struct();
c4->add("+");
c4->add("x");
c4->add("1");
c2->add_list(c4);
c->add_list(c2);
gi->interpret(c);
cons r = new list_struct();
r->add("f");
r->add("6");
cons retVal = gi->interpret(r);
printf("%d\n",retVal->value());
}
and have that print out 7.
How would I do that?
Thanks!
Binesh
- --
PGP Key: http://www.hex21.com/~binesh/binesh-public.asc
PGP Key fingerprint = 421D B4C2 2E96 B8EE 7190 A0CF B42F E71C 7FC3 AD96
SSH2 Key: http://www.hex21.com/~binesh/binesh-ssh2.pub
OpenSSH Key: http://www.hex21.com/~binesh/binesh-openssh.pub
BubbleBabble = xibeb-voges-havez-pabaf-debop-cylil-lelyc-viruv-bygeg-zotoh-dixex
Fingerprint = 9d:7c:84:5d:80:e3:65:8d:ee:9e:a3:b9:56:0a:e9:ad
SSH1 Key: http://www.hex21.com/~binesh/binesh-ssh1.pub
CipherKnight Seals:
http://www.hex21.com/~binesh/binesh-seal.tar.bz2.cs256
http://www.hex21.com/~binesh/binesh-seal.zip.cs256
http://www.hex21.com/~binesh/binesh-certificate.gif.cs256
Decrypt with CipherSaber2 N=256, Password="WelcomeJedi!" (No quotes)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: pgpenvelope 2.10.2 - http://pgpenvelope.sourceforge.net/
iD8DBQFAuYAetC/nHH/DrZYRAnmJAJ9SlaBm8MqZnhvtATshsI3AYMjvtgCg9OT6
QNypnWlRqHi6cGD34YcA7gk=
=AaF0
-----END PGP SIGNATURE-----
- Embedding guile in a C application.,
Binesh Bannerjee <=