common-lispread-eval-print-loopsbclslime

Why is dribble producing an empty file?


I am trying to learn Common Lisp with the book Common Lisp: A gentle introduction to Symbolic Computation. In addition, I am using SBCL, Emacs, and Slime.

By the end of chapter 9, the author shows the dribble tool. He shows the following:

enter image description here enter image description here

I tried to reproduce the commands presented by the author. Considering the inputs, the only difference was the fact that I put a different location to save the file. In my environment, I did:

CL-USER> (dribble "/home/pedro/miscellaneous/misc/symbolic-computation/teste-tool.log")
; No value
CL-USER> (cons 2 nil)
(2)
CL-USER> '(is driblle really working?)
(IS DRIBLLE REALLY WORKING?)
CL-USER> "is dribble useful at all?"
"is dribble useful at all?"
CL-USER> (dribble)
; No value

The file was indeed created:

$ readlink -f teste-tool.log 
/home/pedro/miscellaneous/misc/symbolic-computation/teste-tool.log

Note that I did not get messages such as "Now recording in file --location---" in the REPL while I was typing. But this may vary according to the Lisp implementation.

The big surprise was that, unfortunately, the file was empty. Thus, dribble did not work as expected.

Did I do something wrong?


Solution

    1. Yes, by default, within Slime I don't think this works.

    2. It will work within the SBCL Repl:

    āžœ sbcl
    This is SBCL 2.0.1.debian, an implementation of ANSI Common Lisp.
    More information about SBCL is available at <http://www.sbcl.org/>.
    
    SBCL is free software, provided as is, with absolutely no warranty.
    It is mostly in the public domain; some portions are provided under
    BSD-style licenses.  See the CREDITS and COPYING files in the
    distribution for more information.
    * (dribble "dribble-test.lisp")
    * (* 8 5)
    
    40
    * "Will this work?"
    
    "Will this work?"
    * (dribble)
    
    * %
    

    Which can be confirmed:

    āžœ cat dribble-test.lisp
    * (* 8 5)
    
    40
    * "Will this work?"
    
    "Will this work?"
    * (dribble)
    
    1. Saving "REPL history" seems less useful with Slime IMO because of all the "non-REPL evaluation" that you do by e.g. selecting a function or an expression or region and evaluating that in the REPL.

    2. To actually save and view history within Slime, see slime-repl-save-history and associated functions; you can even merge histories from independent Repls if you so choose :-)