1
0
Fork 0
cl-sites/HyperSpec-7-0/HyperSpec/Body/22_ceb.htm
2024-04-01 10:24:07 +02:00

38 lines
7.1 KiB
HTML

<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
<HTML>
<HEAD>
<TITLE>CLHS: Section 22.3.5.2</TITLE>
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
<LINK REL=TOP HREF="../Front/index.htm">
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
<LINK REL=PREV HREF="22_cea.htm">
<LINK REL=UP HREF="22_ce.htm">
<LINK REL=NEXT HREF="22_cec.htm">
</HEAD>
<BODY>
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="22_cea.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="22_ce.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="22_cec.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>
22.3.5.2 Tilde Less-Than-Sign: Logical Block</H2> <P>
<TT>~&lt;...~:&gt;</TT> <P>
If <TT>~:&gt;</TT> is used to terminate a <TT>~&lt;...~&gt;</TT>, the directive is equivalent to a call to <A REL=DEFINITION HREF="m_ppr_lo.htm#pprint-logical-block"><B>pprint-logical-block</B></A>. The argument corresponding to the <TT>~&lt;...~:&gt;</TT> directive is treated in the same way as the <A REL=DEFINITION HREF="26_glo_l.htm#list"><I>list</I></A> argument to <A REL=DEFINITION HREF="m_ppr_lo.htm#pprint-logical-block"><B>pprint-logical-block</B></A>, thereby providing automatic support for non-<A REL=DEFINITION HREF="26_glo_l.htm#list"><I>list</I></A> arguments and the detection of circularity, sharing, and depth abbreviation. The portion of the <I>control-string</I> nested within the <TT>~&lt;...~:&gt;</TT> specifies the <TT>:prefix</TT> (or <TT>:per-line-prefix</TT>), <TT>:suffix</TT>, and body of the <A REL=DEFINITION HREF="m_ppr_lo.htm#pprint-logical-block"><B>pprint-logical-block</B></A>. <P>
The <I>control-string</I> portion enclosed by <TT>~&lt;...~:&gt;</TT> can be divided into segments <TT>~&lt;</TT><I>prefix</I><TT>~;</TT><I>body</I><TT>~;</TT><I>suffix</I><TT>~:&gt;</TT> by <TT>~;</TT> directives. If the first section is terminated by <TT>~@;</TT>, it specifies a per-line prefix rather than a simple prefix. The <I>prefix</I> and <I>suffix</I> cannot contain format directives. An error is signaled if either the prefix or suffix fails to be a constant string or if the enclosed portion is divided into more than three segments. <P>
If the enclosed portion is divided into only two segments, the <I>suffix</I> defaults to the null string. If the enclosed portion consists of only a single segment, both the <I>prefix</I> and the <I>suffix</I> default to the null string. If the <A REL=DEFINITION HREF="26_glo_c.htm#colon"><I>colon</I></A> modifier is used (i.e., <TT>~:&lt;...~:&gt;</TT>), the <I>prefix</I> and <I>suffix</I> default to <TT>&quot;(&quot;</TT> and <TT>&quot;)&quot;</TT> (respectively) instead of the null string. <P>
The body segment can be any arbitrary <A REL=DEFINITION HREF="26_glo_f.htm#format_string"><I>format string</I></A>. This <A REL=DEFINITION HREF="26_glo_f.htm#format_string"><I>format string</I></A> is applied to the elements of the list corresponding to the <TT>~&lt;...~:&gt;</TT> directive as a whole. Elements are extracted from this list using <A REL=DEFINITION HREF="m_ppr_po.htm#pprint-pop"><B>pprint-pop</B></A>, thereby providing automatic support for malformed lists, and the detection of circularity, sharing, and length abbreviation. Within the body segment, <TT>~^</TT> acts like <A REL=DEFINITION HREF="m_ppr_ex.htm#pprint-exit-if-list-exhausted"><B>pprint-exit-if-list-exhausted</B></A>. <P>
<TT>~&lt;...~:&gt;</TT> supports a feature not supported by <A REL=DEFINITION HREF="m_ppr_lo.htm#pprint-logical-block"><B>pprint-logical-block</B></A>. If <TT>~:@&gt;</TT> is used to terminate the directive (i.e., <TT>~&lt;...~:@&gt;</TT>), then a fill-style conditional newline is automatically inserted after each group of blanks immediately contained in the body (except for blanks after a &lt;Newline&gt; directive). This makes it easy to achieve the equivalent of paragraph filling. <P>
If the <A REL=DEFINITION HREF="26_glo_a.htm#at-sign"><I>at-sign</I></A> modifier is used with <TT>~&lt;...~:&gt;</TT>, the entire remaining argument list is passed to the directive as its argument. All of the remaining arguments are always consumed by <TT>~@&lt;...~:&gt;</TT>, even if they are not all used by the <A REL=DEFINITION HREF="26_glo_f.htm#format_string"><I>format string</I></A> nested in the directive. Other than the difference in its argument, <TT>~@&lt;...~:&gt;</TT> is exactly the same as <TT>~&lt;...~:&gt;</TT> except that circularity detection is not applied if <TT>~@&lt;...~:&gt;</TT> is encountered at top level in a <A REL=DEFINITION HREF="26_glo_f.htm#format_string"><I>format string</I></A>. This ensures that circularity detection is applied only to data lists, not to <A REL=DEFINITION HREF="26_glo_f.htm#format_argument"><I>format argument</I></A> <A REL=DEFINITION HREF="26_glo_l.htm#list"><I>lists</I></A>. <P>
<TT>&quot; . #</TT><I>n</I><TT>#&quot;</TT> is printed if circularity or sharing has to be indicated for its argument as a whole. <P>
To a considerable extent, the basic form of the directive <TT>~&lt;...~&gt;</TT> is incompatible with the dynamic control of the arrangement of output by <TT>~W</TT>, <TT>~_</TT>, <TT>~&lt;...~:&gt;</TT>, <TT>~I</TT>, and <TT>~:T</TT>. As a result, an error is signaled if any of these directives is nested within <TT>~&lt;...~&gt;</TT>. Beyond this, an error is also signaled if the <TT>~&lt;...~:;...~&gt;</TT> form of <TT>~&lt;...~&gt;</TT> is used in the same <A REL=DEFINITION HREF="26_glo_f.htm#format_string"><I>format string</I></A> with <TT>~W</TT>, <TT>~_</TT>, <TT>~&lt;...~:&gt;</TT>, <TT>~I</TT>, or <TT>~:T</TT>. <P>
See also <A REL=CHILD HREF="22_cfb.htm">Section 22.3.6.2 (Tilde Less-Than-Sign: Justification)</A>. <P>
<HR>
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
</BODY>
</HTML>