Next: , Up: Configuring Guile for Guile-CV   [Contents][Index]


Configuring Guile’s repl-print procedure

Guile’s repl-print procedure calls (write val), which is inadequate for Guile-CV images - or for that matter, for any work that involves very large data structure manipulations - even very small images4. Fortunately, Guile provides both a simple mechanism to alter the default repl printer and the alternate repl printer procedure we need: truncated-print.

To modify the default repl printer, you may alter (or add if it doesn’t exist) your $HOME/.guile file or, if you are working in a multi-user environmet, you may alther (or add if it doesn’t exist) the file named init.scm in the Guile global site directory5..

Which ever solution you choose, add the following lines:

(use-modules (ice-9 pretty-print)
             (system repl common))

(repl-default-option-set! 'print
                          (lambda (repl obj)
                            (truncated-print obj) (newline)))

Footnotes

(4)

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

(5)

The Guile global site directory location may be obtained by evaluating the following expression in a terminal): guile -c "(display (%global-site-dir))(newline)". You need write privileges to add or modify this file, contact your system administrator if you’re not in charge of the system you are working on.