34 lines
5.3 KiB
HTML
34 lines
5.3 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.4</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_cec.htm">
|
||
|
<LINK REL=UP HREF="22_ce.htm">
|
||
|
<LINK REL=NEXT HREF="22_cf.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_cec.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_cf.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
||
|
|
||
|
<HR>
|
||
|
|
||
|
<H2>
|
||
|
22.3.5.4 Tilde Slash: Call Function</H2> <P>
|
||
|
<TT>~/</TT><I>name</I><TT>/</TT> <P>
|
||
|
User defined functions can be called from within a format string by using the directive <TT>~/</TT><I>name</I><TT>/</TT>. The <A REL=DEFINITION HREF="26_glo_c.htm#colon"><I>colon</I></A> modifier, the <A REL=DEFINITION HREF="26_glo_a.htm#at-sign"><I>at-sign</I></A> modifier, and arbitrarily many parameters can be specified with the <TT>~/</TT><I>name</I><TT>/</TT> directive. <I>name</I> can be any arbitrary string that does not contain a "/". All of the characters in <I>name</I> are treated as if they were upper case. If <I>name</I> contains a single <A REL=DEFINITION HREF="26_glo_c.htm#colon"><I>colon</I></A> (<TT>:</TT>) or double <A REL=DEFINITION HREF="26_glo_c.htm#colon"><I>colon</I></A> (<TT>::</TT>), then everything up to but not including the first <TT>":"</TT> or <TT>"::"</TT> is taken to be a <A REL=DEFINITION HREF="26_glo_s.htm#string"><I>string</I></A> that names a <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>package</I></A>. Everything after the first <TT>":"</TT> or <TT>"::"</TT> (if any) is taken to be a <A REL=DEFINITION HREF="26_glo_s.htm#string"><I>string</I></A> that names a <TT>symbol</TT>. The function corresponding to a <TT>~/name/</TT> directive is obtained by looking up the <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbol</I></A> that has the indicated name in the indicated <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>package</I></A>. If <I>name</I> does not contain a <TT>":"</TT> or <TT>"::"</TT>, then the whole <I>name</I> string is looked up in the <TT>COMMON-LISP-USER</TT> package. <P>
|
||
|
When a <TT>~/name/</TT> directive is encountered, the indicated function is called with four or more arguments. The first four arguments are: the output stream, the <A REL=DEFINITION HREF="26_glo_f.htm#format_argument"><I>format argument</I></A> corresponding to the directive, a <A REL=DEFINITION HREF="26_glo_g.htm#generalized_boolean"><I>generalized boolean</I></A> that is <A REL=DEFINITION HREF="26_glo_t.htm#true"><I>true</I></A> if the <A REL=DEFINITION HREF="26_glo_c.htm#colon"><I>colon</I></A> modifier was used, and a <A REL=DEFINITION HREF="26_glo_g.htm#generalized_boolean"><I>generalized boolean</I></A> that is <A REL=DEFINITION HREF="26_glo_t.htm#true"><I>true</I></A> if the <A REL=DEFINITION HREF="26_glo_a.htm#at-sign"><I>at-sign</I></A> modifier was used. The remaining arguments consist of any parameters specified with the directive. The function should print the argument appropriately. Any values returned by the function are ignored. <P>
|
||
|
The three <A REL=DEFINITION HREF="26_glo_f.htm#function"><I>functions</I></A> <A REL=DEFINITION HREF="f_ppr_fi.htm#pprint-linear"><B>pprint-linear</B></A>, <A REL=DEFINITION HREF="f_ppr_fi.htm#pprint-fill"><B>pprint-fill</B></A>, and <A REL=DEFINITION HREF="f_ppr_fi.htm#pprint-tabular"><B>pprint-tabular</B></A> are specifically designed so that they can be called by <TT>~/.../</TT> (i.e., <TT>~/pprint-linear/</TT>, <TT>~/pprint-fill/</TT>, and <TT>~/pprint-tabular/</TT>). In particular they take <A REL=DEFINITION HREF="26_glo_c.htm#colon"><I>colon</I></A> and <A REL=DEFINITION HREF="26_glo_a.htm#at-sign"><I>at-sign</I></A> arguments. <P>
|
||
|
<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>
|