On 28 Apr 2011, at 11:41, Andy Wingo wrote: > Guile has a tutorial written by Daniel Kraft, which uses Scheme to > extend a C drawing process. It uses Gnuplot for the drawing, which is > not GNU, and AFAIK not even free software. It would be better to use > some other drawing library; for example, Cairo > (http://cairographics.org/). The output would be to a png file instead > of to the screen. Then we can also show a final stage of switching to > use guile-cairo, and having no C program; and possibly even using a GTK+ > surface instead of a PNG surface, which would allow the same program to > show data to the screen instead of to a file. > > What do people think? Is anyone interested in taking up this task?
Hello, I am interested in working on this. However, I do think that the current gnuplot approach does have some merit in that using relatively simple code you get an interactive session where you can type commands into the Guile REPL and instantly see the results in the gnuplot window. As Daniel notes in the tutorial, drawing to a GTK window would make things markedly more complicated since you then have two main loops (The Guile REPL's and GTK's) that would need to communicate. But perhaps there is some simple way of solving this, I am not very familiar with either Guile and GTK. That said, using Cairo would be nice since in addition to the license issues its API is actually a better fit than gnuplot for the tortoise example. And just generating PNGs would make it simple to automatically insert screenshots when generating the tutorial. One interesting idea would be to build a graphical Guile REPL on top of Cairo, capable of visualizing cairo objects instead of printing out their string representation. May be a tad too complicated for a tutorial though, perhaps? I also think it would be educational to include a section containing a version using the Guile 2.0 dynamic FFI (haven't looked into it but should be possible no?). Lastly, just thought I'd mention an issue that I ran into when building Guile-Cairo (commit 1918626 from Git, looks like it corresponds to 1.9.91). When I run autogen/configure it complains that I need to supply a prefix argument because "the default prefix, /usr/local, is not in the default guile load path." But on my system it is, I built Guile from stable-2.0 branch and installed into the default /usr/local, so I do not think I should be seeing this error (it works if I supply --prefix=/usr/local to Guile-Cairo configure). Regards, Tobias