Dear group,
trying to understand nested backquotes, I define the following macro
(from Paul Graham's On Lisp):
(defmacro abbrev (short long)
`(defmacro ,short (&rest args)
`(,',long ,@args)))
and I try to evaluate
(macroexpand-1 '(abbrev mvb multiple-value-bind))
In sbcl (version 0.9.5) I get
(DEFMACRO MVB (&REST ARGS) `(MULTIPLE-VALUE-BIND ,@ARGS))
which is what I expected.
In cmucl (version 19c) I get:
Error in format: No more arguments.
~:<~^~W~^~5I ~:_~W~3I ··@·······@{ ··@_~W~}~:>
^
[Condition of type FORMAT::FORMAT-ERROR]
Restarts:
0: [ABORT] Return to Top-Level.
Debug (type H for help)
((FLET #:WITH-PRETTY-STREAM-6
PRETTY-PRINT::PPRINT-MULTIPLE-VALUE-BIND)
#<pretty stream {58021915}>)
Source: Error finding source:
Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM: Source file no
longer exists:
target:code/pprint.lisp.
Why the error? Can anyone tell me what am I doing wrong?
Thank you,
Giorgos Pontikakis
"Giorgos Pontikakis" <·······@gmail.com> writes:
> Dear group,
>
> trying to understand nested backquotes, I define the following macro
> (from Paul Graham's On Lisp):
>
> (defmacro abbrev (short long)
> `(defmacro ,short (&rest args)
> `(,',long ,@args)))
>
> and I try to evaluate
> (macroexpand-1 '(abbrev mvb multiple-value-bind))
>
> In sbcl (version 0.9.5) I get
> (DEFMACRO MVB (&REST ARGS) `(MULTIPLE-VALUE-BIND ,@ARGS))
> which is what I expected.
>
> In cmucl (version 19c) I get:
> Error in format: No more arguments.
> ~:<~^~W~^~5I ~:_~W~3I ··@·······@{ ··@_~W~}~:>
> ^
> [Condition of type FORMAT::FORMAT-ERROR]
>
> Restarts:
> 0: [ABORT] Return to Top-Level.
>
> Debug (type H for help)
>
> ((FLET #:WITH-PRETTY-STREAM-6
> PRETTY-PRINT::PPRINT-MULTIPLE-VALUE-BIND)
> #<pretty stream {58021915}>)
> Source: Error finding source:
> Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM: Source file no
> longer exists:
> target:code/pprint.lisp.
>
> Why the error? Can anyone tell me what am I doing wrong?
You're not; this is a bug in routines attached to CMUCL's pretty
printer. Apparently the CMUCL maintainers have decided to add pretty
printing forms for Common Lisp's special operators, so that
(multiple-value-bind (foo bar) (round 3.2 1.3) (frob) (frob))
would be printed as
(multiple-value-bind
(foo bar)
(round 3.2 1.3)
(frob)
(frob))
(if all the newlines were needed). However the implementation of this
has failed to be robust against the use of multiple-value-bind in
different contexts.
Christophe
Giorgos Pontikakis wrote:
> Dear group,
>
> trying to understand nested backquotes, I define the following macro
> (from Paul Graham's On Lisp):
You might enjoy Alan Bawden's "Quasiquotation in Lisp":
<http://www.linearity.org/bawden/ftp/quasiquote-v59.ps.gz>
--
Jens Axel S�gaard
Thank both of you for the answers.
I suppose that this is a known bug and I should not be bothered
reporting it to the CMUCL maintainers.
And that paper of Alan Bawden was very helpful. Thanks for the link.
Giorgos
>>>>> "Giorgos" == Giorgos Pontikakis <·······@gmail.com> writes:
Giorgos> I suppose that this is a known bug and I should not be bothered
Giorgos> reporting it to the CMUCL maintainers.
You should have reported it to the maintainers, but someone else has
reported the problem (with a fix, too!). It doesn't hurt, and I don't
know how often maintainers read comp.lang.lisp.
Anyway, you can find a patch for this bug at
http://common-lisp.net/webftp/pub/project/cmucl/release/19c/patches/cmucl-19c-patch-001.tar.gz
You either just download the file, untar it, use asdf to load the
patch, or just manually load the patch file.
Alternatively, you should be able to use asdf-install to install this
patch.
Ray
Raymond Toy <···········@ericsson.com> wrote:
+---------------
| Anyway, you can find a patch for this bug at
| http://common-lisp.net/webftp/pub/project/cmucl/release/19c/patches/cmucl-19c-patch-001.tar.gz
|
| You either just download the file, untar it, use asdf to load the
| patch, or just manually load the patch file.
+---------------
Hmmm... FWIW, it still fails for me even after loading the patch:
$ $CMU19c/bin/lisp -noinit -nositeinit
CMU Common Lisp 19c (19C), running on gar.agami.com
With core: /usr/u/rpw3/src/cmd/cmucl-19c/lib/cmucl/lib/lisp.core
Dumped on: Thu, 2005-11-17 06:12:58-08:00 on lorien
See <http://www.cons.org/cmucl/> for support information.
Loaded subsystems:
Python 1.1, target Intel x86
CLOS based on Gerd's PCL 2004/04/14 03:32:47
* (load "src/cmd/cmucl-19c-patch-001/cmucl-19c-patch-001.lisp")
; Loading #P"/usr/u/rpw3/src/cmd/cmucl-19c-patch-001/cmucl-19c-patch-001.lisp".
T
* (defmacro abbrev (short long)
`(defmacro ,short (&rest args)
`(,',long ,@args)))
ABBREV
* (macroexpand-1 '(abbrev mvb multiple-value-bind))
(DEFMACRO MVB (&REST ARGS)
`(MULTIPLE-VALUE-BIND ,@ARGS
Error in format: No more arguments.
~:<~^~W~^~5I ~:_~W~3I ··@·······@{ ··@_~W~}~:>
^
[Condition of type FORMAT::FORMAT-ERROR]
Restarts:
0: [ABORT] Return to Top-Level.
Debug (type H for help)
((FLET #:WITH-PRETTY-STREAM-6
PRETTY-PRINT::PPRINT-MULTIPLE-VALUE-BIND)
#<pretty stream {5801AEF5}>)
Source: Error finding source:
Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM: Source file no longer exists:
target:code/pprint.lisp.
0]
-Rob
p.s. Note that it works fine on CMUCL-19a:
With core: /usr/u/rpw3/src/cmd/cmucl-19a/lib/cmucl/lib/lisp.core
Dumped on: Wed, 2004-07-28 09:51:48-07:00 on lorien
...
> (macroexpand-1 '(abbrev mvb multiple-value-bind))
(DEFMACRO MVB (&REST ARGS) `(MULTIPLE-VALUE-BIND ,@ARGS))
T
>
-----
Rob Warnock <····@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607
>>>>> "Rob" == Rob Warnock <····@rpw3.org> writes:
Rob> Hmmm... FWIW, it still fails for me even after loading the patch:
Argh.
How stupid of me. I put the pushnew for :cmucl-19c-patch-001 at the
beginning of the file instead of the end. If you move the pushnew to
the end, it works for me.
It works when compiled, though, which is what I did when I tested
this, via asdf.
I'll put up a patch-001a soon.
Ray
Raymond Toy <···········@ericsson.com> wrote:
+---------------
| >>>>> "Rob" == Rob Warnock <····@rpw3.org> writes:
| Rob> Hmmm... FWIW, it still fails for me even after loading the patch:
|
| Argh.
| How stupid of me. I put the pushnew for :cmucl-19c-patch-001 at the
| beginning of the file instead of the end. If you move the pushnew to
| the end, it works for me.
+---------------
Yes, me too. *D'OH!* I should have seen it myself, since I had
already admired the #+(AND cmu19c (NOT cmucl-19c-patch-001))
in front of the SET-PPRINT-DISPATCH!! ;-} ;-}
-Rob
-----
Rob Warnock <····@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607
>>>>> "Rob" == Rob Warnock <····@rpw3.org> writes:
Rob> Raymond Toy <···········@ericsson.com> wrote:
Rob> +---------------
Rob> | >>>>> "Rob" == Rob Warnock <····@rpw3.org> writes:
Rob> | Rob> Hmmm... FWIW, it still fails for me even after loading the patch:
Rob> |
Rob> | Argh.
Rob> | How stupid of me. I put the pushnew for :cmucl-19c-patch-001 at the
Rob> | beginning of the file instead of the end. If you move the pushnew to
Rob> | the end, it works for me.
Rob> +---------------
Rob> Yes, me too. *D'OH!* I should have seen it myself, since I had
Rob> already admired the #+(AND cmu19c (NOT cmucl-19c-patch-001))
Rob> in front of the SET-PPRINT-DISPATCH!! ;-} ;-}
Heh. New patch available. This one should work. Look for
cmucl-19c-patch-001a.
Ray
Thank both of you for the answers.
I suppose that this is a known bug and I should not be bothered
reporting it to the CMUCL maintainers.
And that paper of Alan Bawden was very helpful. Thanks for the link.
Giorgos