unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Embedding guile in a C application.
@ 2004-05-30  6:32 Binesh Bannerjee
  2004-05-30 15:45 ` Linas Vepstas
  0 siblings, 1 reply; 7+ messages in thread
From: Binesh Bannerjee @ 2004-05-30  6:32 UTC (permalink / raw)


-----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-----


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

end of thread, other threads:[~2004-08-09 22:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-30  6:32 Embedding guile in a C application Binesh Bannerjee
2004-05-30 15:45 ` Linas Vepstas
2004-05-31  5:54   ` Binesh Bannerjee
2004-05-31  6:02     ` Binesh Bannerjee
2004-05-31 19:54       ` Mike Gran
2004-06-01 10:00         ` rm
2004-08-09 22:51           ` Marius Vollmer

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).