LW DRIBBLE (& Tab Completion)
Hi all, I'm on LWM6.0 (and use tab completion) and was a bit surprised
at what DRIBBLE put in its output file. Anyone know if this is
intended behavior or just a quirk? "dribble is intended to create a
readable record of an interactive session" [1], and there's a sense in
DRIBBLE's output qualifies, but this diminishes in even slightly more
complex cases. Illustrations follow. (This isn't a huge issue for
me; the only reason I was using DRIBBLE at all was that I was trying
to record a session that hangs the IDE, and so from which I can't copy
and paste the Listener session after the bug.)
[1] http://www.lispworks.com/documentation/HyperSpec/Body/f_dribbl.htm
A session in the Listener:
CL-USER 1 >
(dribble "~/Desktop/dribble2.txt")
; Loading /Applications/LispWorks
6.0/Library/lib/6-0-0-0/load-on-demand/ccl/dribble.xfasl on demand...
Error while reading: Symbol "MAKE-IN" not found at all in the CAPI package.
"""
CL-USER 2 >
(defparameter *interface*
(capi:display (make-instance 'capi:interface)))
*INTERFACE*
CL-USER 3 >
(capi:prompt-for-file "pick a file" :owner *interface*)
NIL
NIL
NIL
CL-USER 4 >
(dribble)
; Closed dribble to "~/Desktop/dribble2.txt"
"""
The corresponding dribble output:
"""
CL-USER 2 >
(defpar
(defparameter *interface*
(capi:displa
(defparameter *interface*
(capi:display (make-in
(defparameter *interface*
(capi:display (make-instance 'capi:interf
(defparameter *interface*
(capi:display (make-instance 'capi:interface)))
*INTERFACE*
CL-USER 3 >
(capi:prom
(capi:prompt-fo
(capi:prompt-for-fi
(capi:prompt-for-file "pick a file" :owne
(capi:prompt-for-file "pick a file" :owner *interf
(capi:prompt-for-file "pick a file" :owner *interface*)
NIL
NIL
NIL
CL-USER 4 >
(dribb
(dribble)
"""
A more complex example. (Comments are added in afterward, and are not
part of the original session).
"""
CL-USER 6 >
(defun factorial (n)
(labels ((fac (n acc)
(if (<= n 0)
(defun factorial (n)
(labels ((fac (n acc)
(if (<= n 0) acc
(fac (1- n)))))
(fac ; oh wait, make acc optional, and the base case 1, and pass acc to fac
(defun factorial (n)
(labels ((fac (n &optional (acc 1))
(if (<= n 1) acc
(fac (1- n) acc))))
(fac n)))
FACTORIAL
CL-USER 7 > (factorial 10)
1 ; oops, forgot to multiply
CL-USER 8 > (factorial 10) ; Ctrl-C Ctrl-P for previous form
(defun factorial (n) ; and again to get the defun
(labels ((fac (n &optional (acc 1))
(if (<= n 1) acc
(fac (1- n) acc))))
(fac n)))
(defun factorial (n)
(labels ((fac (n &optional (acc 1))
(if (<= n 1) acc
(fac (1- n) (* n acc))))) ; add in the multiplication
(fac n)))
FACTORIAL
CL-USER 9 >
(defun factorial (n)
(labels ((fac (n &optional (acc 1))
(if (<= n 1) acc
(fac (1- n) (* n acc)))))
(fac n)))(factorial 10)
3628800
CL-USER 10 > (dribble)
"""
--
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/