pprint-lambda-list

Peter Stirling peter at pjstirling.plus.com
Sun Oct 18 18:22:19 UTC 2015


Hi,

As part of implementing slime-style macroexpansion in a web app 
(code[1], demo[2]), I've noticed an oddity in sbcl's pretty printing:

CL-USER> (pprint '(lambda (&key (bar 'baz))))

(LAMBDA (&KEY (BAR (QUOTE BAZ))))
; No value
CL-USER> (pprint '(lambda (foo &key (bar 'baz))))

(LAMBDA (FOO &KEY (BAR 'BAZ)))
; No value

Looking in the source for SB-PRETTY:PPRINT-LAMBDA-LIST[3] it appears to 
be written as a state machine, and there are 2 bugs: first the state is 
set once, and only once, because the state change CASE only runs  when 
FIRST is null (and therefore if you have a positional argument, then all 
subsequent arguments are printed as if positional), the second is to do 
with printing default values.

1 https://github.com/pjstirling/pastecode
2 http://pjstirling.plus.com/paste/expand/?id=5&entry=5
3 sbcl/src/code/pprint.lisp:1031

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus




More information about the slime-devel mailing list