75 lines
6.5 KiB
HTML
75 lines
6.5 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: Function Y-OR-N-P, YES-OR-NO-P</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="f_finish.htm">
|
|
<LINK REL=UP HREF="c_stream.htm">
|
|
<LINK REL=NEXT HREF="f_mk_syn.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="f_finish.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="c_stream.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="f_mk_syn.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
<A NAME="y-or-n-p"><A NAME="yes-or-no-p"><I>Function</I> <B>Y-OR-N-P, YES-OR-NO-P</B></A></A> <P>
|
|
<P><B>Syntax:</B><P>
|
|
<P>
|
|
|
|
<B>y-or-n-p</B> <I><TT>&optional</TT> control <TT>&rest</TT> arguments</I> => <I>generalized-boolean</I><P>
|
|
|
|
<B>yes-or-no-p</B> <I><TT>&optional</TT> control <TT>&rest</TT> arguments</I> => <I>generalized-boolean</I><P>
|
|
<P>
|
|
<P><B>Arguments and Values:</B><P>
|
|
<P>
|
|
<I>control</I>---a <A REL=DEFINITION HREF="26_glo_f.htm#format_control"><I>format control</I></A>. <P>
|
|
<I>arguments</I>---<A REL=DEFINITION HREF="26_glo_f.htm#format_argument"><I>format arguments</I></A> for <I>control</I>. <P>
|
|
<I>generalized-boolean</I>---a <A REL=DEFINITION HREF="26_glo_g.htm#generalized_boolean"><I>generalized boolean</I></A>. <P>
|
|
<P><B>Description:</B><P>
|
|
<P>
|
|
These functions ask a question and parse a response from the user. They return <A REL=DEFINITION HREF="26_glo_t.htm#true"><I>true</I></A> if the answer is affirmative, or <A REL=DEFINITION HREF="26_glo_f.htm#false"><I>false</I></A> if the answer is negative. <P>
|
|
<A REL=DEFINITION HREF="#y-or-n-p"><B>y-or-n-p</B></A> is for asking the user a question whose answer is either ``yes'' or ``no.'' It is intended that the reply require the user to answer a yes-or-no question with a single character. <A REL=DEFINITION HREF="#yes-or-no-p"><B>yes-or-no-p</B></A> is also for asking the user a question whose answer is either ``Yes'' or ``No.'' It is intended that the reply require the user to take more action than just a single keystroke, such as typing the full word <TT>yes</TT> or <TT>no</TT> followed by a newline. <P>
|
|
<A REL=DEFINITION HREF="#y-or-n-p"><B>y-or-n-p</B></A> types out a message (if supplied), reads an answer in some <A REL=DEFINITION HREF="26_glo_i.htm#implementation-dependent"><I>implementation-dependent</I></A> manner (intended to be short and simple, such as reading a single character such as <TT>Y</TT> or <TT>N</TT>). <A REL=DEFINITION HREF="#yes-or-no-p"><B>yes-or-no-p</B></A> types out a message (if supplied), attracts the user's attention (for example, by ringing the terminal's bell), and reads an answer in some <A REL=DEFINITION HREF="26_glo_i.htm#implementation-dependent"><I>implementation-dependent</I></A> manner (intended to be multiple characters, such as <TT>YES</TT> or <TT>NO</TT>). <P>
|
|
If <I>format-control</I> is supplied and not <A REL=DEFINITION HREF="a_nil.htm#nil"><B>nil</B></A>, then a <A REL=DEFINITION HREF="f_terpri.htm#fresh-line"><B>fresh-line</B></A> operation is performed; then a message is printed as if <I>format-control</I> and <I>arguments</I> were given to <A REL=DEFINITION HREF="f_format.htm#format"><B>format</B></A>. In any case, <A REL=DEFINITION HREF="#yes-or-no-p"><B>yes-or-no-p</B></A> and <A REL=DEFINITION HREF="#y-or-n-p"><B>y-or-n-p</B></A> will provide a prompt such as ``<TT>(Y or N)</TT>'' or ``<TT>(Yes or No)</TT>'' if appropriate. <P>
|
|
All input and output are performed using <A REL=DEFINITION HREF="26_glo_q.htm#query_iSLo"><I>query I/O</I></A>. <P>
|
|
<P><B>Examples:</B><P>
|
|
|
|
<PRE>
|
|
(y-or-n-p "(t or nil) given by")
|
|
>> (t or nil) given by (Y or N) Y
|
|
=> <A REL=DEFINITION HREF="26_glo_t.htm#true">true</A>
|
|
(yes-or-no-p "a ~S message" 'frightening)
|
|
>> a FRIGHTENING message (Yes or No) no
|
|
=> <A REL=DEFINITION HREF="26_glo_f.htm#false">false</A>
|
|
(y-or-n-p "Produce listing file?")
|
|
>> Produce listing file?
|
|
>> Please respond with Y or N. n
|
|
=> <A REL=DEFINITION HREF="26_glo_f.htm#false">false</A>
|
|
</PRE>
|
|
</TT> <P>
|
|
<P><B>Side Effects:</B><P>
|
|
<P>
|
|
Output to and input from <A REL=DEFINITION HREF="26_glo_q.htm#query_iSLo"><I>query I/O</I></A> will occur. <P>
|
|
<P><B>Affected By:</B><P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="v_debug_.htm#STquery-ioST"><B>*query-io*</B></A>. <P>
|
|
<P><B>Exceptional Situations:</B> None.
|
|
<P>
|
|
<P><B>See Also:</B><P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="f_format.htm#format"><B>format</B></A> <P>
|
|
<P><B>Notes:</B><P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="#yes-or-no-p"><B>yes-or-no-p</B></A> and <A REL=DEFINITION HREF="#yes-or-no-p"><B>yes-or-no-p</B></A> do not add question marks to the end of the prompt string, so any desired question mark or other punctuation should be explicitly included in the text query. <P>
|
|
<P><HR>The following <A REL=META HREF="../Front/X3J13Iss.htm">X3J13 cleanup issue</A>, <I>not part of the specification</I>, applies to this section:<P><UL><LI> <A REL=CHILD HREF="../Issues/iss170.htm">FORMAT-STRING-ARGUMENTS:SPECIFY</A><P></UL><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>
|