[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-plotutils] Re: Guile bindings for Plotutils

From: Mike Gran
Subject: [Bug-plotutils] Re: Guile bindings for Plotutils
Date: Sun, 1 Aug 2010 07:51:30 -0700 (PDT)

> From: "address@hidden" address@hidden


> I assume that by plotutils bindings, you mean mostly libplot
> bindings?  It's interesting to consider what a well-designed
> interface to libplot from Scheme or any other Lisp-like
> language would look like.

I've got very rough implementations of both libplot bindings and
graph 'bindings'.  For graph, I converted the main() into
a Guile function, replaced the getopt parsing with function
input parameters, and made the read_point function in the reader
read a value from a Scheme list instead of a file.

> The last interface to a large graphics library from Lisp that
> I personally looked over was the interface to X11 from Franz
> Lisp, many years ago.  As I recall it wasn't very Lisp-like.


> Is the projected guile interface likewise expected to be
> guile-like?

Our current hack isn't very Scheme-like.  Something like this...

(define gr (newpl "X" (current-output-port) (current-error-port))
(erase! gr)
(pencolorname! gr "red")
(ellipse! gr 1 2 3 4 5)

and so on.

It would be closer to functional style to avoid having to modify
a variable.  Something like this...

(ellipse 1 2 3 4 5 (pencolorname "red" (erase (newpl))))

Behind the scenes, that means each function returns a
newly allocated, slightly modified copy of the previous plPlotter,
while the previous plPlotter is eventually freed by the garbage
collector.  Libplot itself might have to be modified to
support this kind of programming.

The graph binding is more Scheme-like. A simple plot might
be created like this

(graph xdatavector ydatavector
       #:output-format "X"
       #:title "Plot")

> Would it be reasonable for a guile interface to be distributed
> with plotutils, i.e., so that it is installed into the guile
> area by the plotutils automake/autoconf setup, if guile is
> available at plotutils compilation and installation time?

That would be great.

> --Rob


reply via email to

[Prev in Thread] Current Thread [Next in Thread]