Next: , Up: Using Guile-CV   [Contents][Index]


2.1 Configuring Guile’s repl-print procedure

Guile’s repl-print procedure _must_ be modified before to start to use Guile-CV. The default Guile’s repl-print procedure calls (write val), which is inadequate for images, even very small images2.

Unfortunately, Guile does not provide a simple way for its users to modify its repl-print procedure, so, for now, there is no other way but ’getting your hands dirty’ here :), but no big deal either, here are the steps.

The module we need to modify is (system repl common), so let’s first figure out where it is on your system3:

guile
...
scheme@(guile-user)> (string-append (%package-data-dir) "/" (effective-version))
-|
$2 = "/opt2/share/guile/2.2"

The above returned value is an example of course, just proceed with the value returned by your system. So, the file we need to edit, in our example, is here:

/opt2/share/guile/2.2/system/repl/common.scm

Edit the above file and:

  1. Add the following module to the list of imported modules:
    #:use-module (ice-9 pretty-print)
    
  2. Search for the repl-print definition and, at the end of the procedure definition, replace:
    (write val)
    

    by

    (truncated-print val)
    

Save the file of course, and your good to play with Guile-CV.


Footnotes

(2)

Even for very small images, using write is inadequate, in a terminal, and will definitely kill your Emacs/Geiser session. Not to mention it will raise your electricity bill :) - till you succeed to delete its process, Emacs will use one core at more then 100%, desperately trying to display hundreds of thousands of floating point values, heating your laptop (if you have a laptop) up to the point you’ll be able to cook an egg on it, and get its fans crasy... You’ve been warned :).

(3)

You need write privileges to modify this module, contact your admin if you’re not in charge of the system you are working on.