From: Robert B. <bo...@cs...> - 2007-03-07 16:20:53
|
In the ANSI standard for Common Lisp we read ~<...~:> supports a feature not supported by pprint-logical-block. If ~:@> is used to terminate the directive (i.e., ~<...~:@>), then a fill-style conditional newline is automatically inserted after each group of blanks immediately contained in the body (except for blanks after a ~\NewlineChar\ directive). This makes it easy to achieve the equivalent of paragraph filling. I am very often wrong about these things, but I suspect that Clisp and OPENMCL get right while Allegro, CMU, SBCL, and GCL get wrong this one liner: (format t "~<Options~:@>") Bob ------------------------------------------------------------ % clisp ... Copyright (c) Sam Steingold, Bruno Haible 2001-2005 [1]> (format t "~<Options~:@>") Options NIL [2]> Bye. % gcl GCL (GNU Common Lisp) 2.6.7 CLtL1 Sep 1 2005 16:07:23 ... >(format t "~<Options~:@>") Error: Format error: ~> expected. V "~<Options~:@>" % cmucl CMU Common Lisp 19b (19B), running on elgin.cs.utexas.edu ... * (format t "~<Options~:@>") Error in format: No more arguments. ~<Options~:@> ^ [Condition of type FORMAT::FORMAT-ERROR] % openmcl Welcome to OpenMCL Version 1.1-pre-070214 (DarwinX8664)! ? (format t "~<Options~:@>") Options NIL ? % sbcl This is SBCL 0.9.8, an implementation of ANSI Common Lisp. ... * (format t "~<Options~:@>") debugger invoked on a SB-FORMAT:FORMAT-ERROR: error in FORMAT: no more arguments ~<Options~:@> ^ % abcl Armed Bear Common Lisp 0.0.8 (built Sat Oct 15 2005 12:01:10 -0600) ... CL-USER(1): (format t "~<Options~:@>") Debugger invoked on condition of type FORMAT-ERROR: error in format: no more arguments ~<Options~:@> ^ Restarts: 0: TOP-LEVEL Return to top level. [1] CL-USER(2): |
From: Guy S. <Guy...@su...> - 2007-03-07 18:27:48
|
On the contrary, I believe, judging from your thorough examples, that cmucl, sbcl, and abcl got it right, and the other did not. The one-liner is erroneous because ~<...~:> (or ~<...~:@>), unlike ~<...~>, requires (and uses up) a format argument, and the one-liner fails to provide such a format argument. All of cmucl, sbcl, and abcl correctly report this error; the others do not. I would be interested in seeing the results of trying the one-liner (format t "~<Options~:@>" (make-list 100 :initial-element 'foo)) in all these various implementations. --Guy On Mar 7, 2007, at 11:20 AM, Robert Boyer wrote: > In the ANSI standard for Common Lisp we read > > ~<...~:> supports a feature not supported by > pprint-logical-block. If ~:@> is used to terminate the > directive (i.e., ~<...~:@>), then a fill-style > conditional newline is automatically inserted after each > group of blanks immediately contained in the body (except > for blanks after a ~\NewlineChar\ directive). This makes > it easy to achieve the equivalent of paragraph filling. > > I am very often wrong about these things, but I suspect that > Clisp and OPENMCL get right while Allegro, CMU, SBCL, and > GCL get wrong this one liner: > > (format t "~<Options~:@>") > > Bob > > ------------------------------------------------------------ > > % clisp > ... > Copyright (c) Sam Steingold, Bruno Haible 2001-2005 > [1]> (format t "~<Options~:@>") > Options > NIL > [2]> > Bye. > > > % gcl > GCL (GNU Common Lisp) 2.6.7 CLtL1 Sep 1 2005 16:07:23 > ... >> (format t "~<Options~:@>") > > Error: Format error: ~> expected. > V > "~<Options~:@>" > > > % cmucl > CMU Common Lisp 19b (19B), running on elgin.cs.utexas.edu > ... > * (format t "~<Options~:@>") > > Error in format: No more arguments. > ~<Options~:@> > ^ > [Condition of type FORMAT::FORMAT-ERROR] > > > % openmcl > Welcome to OpenMCL Version 1.1-pre-070214 (DarwinX8664)! > ? (format t "~<Options~:@>") > Options > NIL > ? > > % sbcl > This is SBCL 0.9.8, an implementation of ANSI Common Lisp. > ... > * (format t "~<Options~:@>") > > debugger invoked on a SB-FORMAT:FORMAT-ERROR: > error in FORMAT: no more arguments > ~<Options~:@> > ^ > > % abcl > Armed Bear Common Lisp 0.0.8 (built Sat Oct 15 2005 12:01:10 -0600) > ... > CL-USER(1): (format t "~<Options~:@>") > Debugger invoked on condition of type FORMAT-ERROR: > error in format: no more arguments > ~<Options~:@> > ^ > Restarts: > 0: TOP-LEVEL Return to top level. > [1] CL-USER(2): |