126 lines
11 KiB
HTML
126 lines
11 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: Issue RANGE-OF-START-AND-END-PARAMETERS Writeup</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="../Issues/iss283_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss284.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss285_w.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="../Issues/iss283_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss284.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss285_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue RANGE-OF-START-AND-END-PARAMETERS Writeup</H2>
|
|
|
|
<PRE><B>Issue:</B> <A HREF="iss284.htm">RANGE-OF-START-AND-END-PARAMETERS</A><P>
|
|
<B>References:</B> <A REL=DEFINITION HREF="../Body/f_countc.htm#count"><B>COUNT</B></A> (p257), <A REL=DEFINITION HREF="../Body/f_countc.htm#count-if"><B>COUNT-IF</B></A> (p257), <A REL=DEFINITION HREF="../Body/f_countc.htm#count-if-not"><B>COUNT-IF-NOT</B></A> (p257),<P>
|
|
<A REL=DEFINITION HREF="../Body/f_rm_rm.htm#delete"><B>DELETE</B></A> (p257), <A REL=DEFINITION HREF="../Body/f_rm_dup.htm#delete-duplicates"><B>DELETE-DUPLICATES</B></A> (p254), <A REL=DEFINITION HREF="../Body/f_rm_rm.htm#delete-if"><B>DELETE-IF</B></A> (p254),<P>
|
|
<A REL=DEFINITION HREF="../Body/f_rm_rm.htm#delete-if-not"><B>DELETE-IF-NOT</B></A> (p254), <A REL=DEFINITION HREF="../Body/f_fill.htm#fill"><B>FILL</B></A> (p252), <A REL=DEFINITION HREF="../Body/f_find_.htm#find"><B>FIND</B></A> (p257), <A REL=DEFINITION HREF="../Body/f_find_.htm#find-if"><B>FIND-IF</B></A> (p257),<P>
|
|
<A REL=DEFINITION HREF="../Body/f_find_.htm#find-if-not"><B>FIND-IF-NOT</B></A> (p257), <A REL=DEFINITION HREF="../Body/f_mk_s_1.htm#make-string-input-stream"><B>MAKE-STRING-INPUT-STREAM</B></A> (p330),<P>
|
|
<A REL=DEFINITION HREF="../Body/f_mismat.htm#mismatch"><B>MISMATCH</B></A> (p257), <A REL=DEFINITION HREF="../Body/f_stg_up.htm#nstring-capitalize"><B>NSTRING-CAPITALIZE</B></A> (p304), <P>
|
|
<A REL=DEFINITION HREF="../Body/f_stg_up.htm#nstring-downcase"><B>NSTRING-DOWNCASE</B></A> (p304), <A REL=DEFINITION HREF="../Body/f_stg_up.htm#nstring-upcase"><B>NSTRING-UPCASE</B></A> (p304), <A REL=DEFINITION HREF="../Body/f_sbs_s.htm#substitute"><B>SUBSTITUTE</B></A> (p255),<P>
|
|
<A REL=DEFINITION HREF="../Body/f_sbs_s.htm#nsubstitute-if"><B>NSUBSTITUTE-IF</B></A> (p256), <A REL=DEFINITION HREF="../Body/f_sbs_s.htm#nsubstitute-if-not"><B>NSUBSTITUTE-IF-NOT</B></A> (p256), <P>
|
|
<A REL=DEFINITION HREF="../Body/f_parse_.htm#parse-integer"><B>PARSE-INTEGER</B></A> (p381), <A REL=DEFINITION HREF="../Body/f_pars_1.htm#parse-namestring"><B>PARSE-NAMESTRING</B></A> (p414), <A REL=DEFINITION HREF="../Body/f_pos_p.htm#position"><B>POSITION</B></A> (p257),<P>
|
|
<A REL=DEFINITION HREF="../Body/f_pos_p.htm#position-if"><B>POSITION-IF</B></A> (p257), <A REL=DEFINITION HREF="../Body/f_pos_p.htm#position-if-not"><B>POSITION-IF-NOT</B></A> (p257), <P>
|
|
<A REL=DEFINITION HREF="../Body/f_rd_fro.htm#read-from-string"><B>READ-FROM-STRING</B></A> (p381), <A REL=DEFINITION HREF="../Body/f_reduce.htm#reduce"><B>REDUCE</B></A> (p251), <A REL=DEFINITION HREF="../Body/f_rm_rm.htm#remove"><B>REMOVE</B></A> (p253), <P>
|
|
<A REL=DEFINITION HREF="../Body/f_rm_dup.htm#remove-duplicates"><B>REMOVE-DUPLICATES</B></A> (p254), <A REL=DEFINITION HREF="../Body/f_rm_rm.htm#remove-if"><B>REMOVE-IF</B></A> (p253), <A REL=DEFINITION HREF="../Body/f_rm_rm.htm#remove-if-not"><B>REMOVE-IF-NOT</B></A> (p253),<P>
|
|
<A REL=DEFINITION HREF="../Body/f_replac.htm#replace"><B>REPLACE</B></A> (p252), <A REL=DEFINITION HREF="../Body/f_search.htm#search"><B>SEARCH</B></A> (p258), <A REL=DEFINITION HREF="../Body/f_stg_up.htm#string-capitalize"><B>STRING-CAPITALIZE</B></A> (p303),<P>
|
|
<A REL=DEFINITION HREF="../Body/f_stgeq_.htm#string-equal"><B>STRING-EQUAL</B></A> (p301), <A REL=DEFINITION HREF="../Body/f_stg_up.htm#string-downcase"><B>STRING-DOWNCASE</B></A> (p303), <A REL=DEFINITION HREF="../Body/f_stgeq_.htm#string-greaterp"><B>STRING-GREATERP</B></A> (p302),<P>
|
|
<A REL=DEFINITION HREF="../Body/f_stgeq_.htm#string-lessp"><B>STRING-LESSP</B></A> (p302), <A REL=DEFINITION HREF="../Body/f_stgeq_.htm#string-not-equal"><B>STRING-NOT-EQUAL</B></A> (p302),<P>
|
|
<A REL=DEFINITION HREF="../Body/f_stgeq_.htm#string-not-greaterp"><B>STRING-NOT-GREATERP</B></A> (p302), <A REL=DEFINITION HREF="../Body/f_stgeq_.htm#string-not-lessp"><B>STRING-NOT-LESSP</B></A> (p302),<P>
|
|
<A REL=DEFINITION HREF="../Body/f_stg_up.htm#string-upcase"><B>STRING-UPCASE</B></A> (p303), <A REL=DEFINITION HREF="../Body/f_stgeq_.htm#stringSLEQ"><B>STRING/=</B></A> (p301), <A REL=DEFINITION HREF="../Body/f_stgeq_.htm#stringLT"><B>STRING<</B></A> (p301), <P>
|
|
<A REL=DEFINITION HREF="../Body/f_stgeq_.htm#stringLTEQ"><B>STRING<=</B></A> (p301), <A REL=DEFINITION HREF="../Body/f_stgeq_.htm#stringEQ"><B>STRING=</B></A> (p300), <A REL=DEFINITION HREF="../Body/f_stgeq_.htm#stringGT"><B>STRING></B></A> (p301), <A REL=DEFINITION HREF="../Body/f_stgeq_.htm#stringGTEQ"><B>STRING>=</B></A> (p301),<P>
|
|
<A REL=DEFINITION HREF="../Body/f_subseq.htm#subseq"><B>SUBSEQ</B></A> (p248), <A REL=DEFINITION HREF="../Body/f_sbs_s.htm#substitute"><B>SUBSTITUTE</B></A> (p255), <A REL=DEFINITION HREF="../Body/f_sbs_s.htm#substitute-if"><B>SUBSTITUTE-IF</B></A> (p255), <P>
|
|
<A REL=DEFINITION HREF="../Body/f_sbs_s.htm#substitute-if-not"><B>SUBSTITUTE-IF-NOT</B></A> (p255), <A REL=DEFINITION HREF="../Body/f_wr_stg.htm#write-line"><B>WRITE-LINE</B></A> (p384), <A REL=DEFINITION HREF="../Body/f_wr_stg.htm#write-string"><B>WRITE-STRING</B></A> (p384)<P>
|
|
<B>Category:</B> CLARIFICATION<P>
|
|
<B>Edit history:</B> 14-Sep-88, Version 1 by Pitman<P>
|
|
<P>
|
|
<B>Problem Description:<P>
|
|
</B><P>
|
|
CLtL is not always clear about the possible values which the START and END<P>
|
|
parameters of built-in Common Lisp can take.<P>
|
|
<P>
|
|
<B>Proposal (RANGE-OF-START-AND-END-PARAMETERS:INTEGER-AND-INTEGER-NIL):<P>
|
|
</B><P>
|
|
Clarify that for functions permitting a parameter named START, START1,<P>
|
|
or START2 which delimits the beginning point in a sequence to be<P>
|
|
considered for some operation, that paremeter must be a non-negative<P>
|
|
integer. If the argument is optional or key (as is the case for all<P>
|
|
functions referenced above except <A REL=DEFINITION HREF="../Body/f_subseq.htm#subseq"><B>SUBSEQ</B></A>), the value will default to<P>
|
|
0 if not supplied. It is not permissible to pass <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> as this argument.<P>
|
|
<P>
|
|
Clarify that for functions permitting a parameter named END, END1,<P>
|
|
or END2 which delimits the end point in a sequence to be considered<P>
|
|
for some operation, that paremeter must be a non-negative integer<P>
|
|
indicating a termination point or <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> indicating the last element<P>
|
|
in the sequence. If the argument is optional or key (as is the case<P>
|
|
for all functions referenced above), the value will default to <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A><P>
|
|
if not supplied. Supplying <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> is, therefore, equivalent to not<P>
|
|
supplying this argument.<P>
|
|
<P>
|
|
<B>Test Case:<P>
|
|
</B><P>
|
|
(<A REL=DEFINITION HREF="../Body/f_search.htm#search"><B>SEARCH</B></A> "F" "FOO" :START1 <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A>) is an error.<P>
|
|
<P>
|
|
(<A REL=DEFINITION HREF="../Body/f_search.htm#search"><B>SEARCH</B></A> "F" "FOO" :START2 0) is permissible and is equivalent to<P>
|
|
(<A REL=DEFINITION HREF="../Body/f_search.htm#search"><B>SEARCH</B></A> "F" "FOO")<P>
|
|
<P>
|
|
(<A REL=DEFINITION HREF="../Body/f_search.htm#search"><B>SEARCH</B></A> "F" "FOO" :END2 <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A>) is permissible and is equivalent to<P>
|
|
(<A REL=DEFINITION HREF="../Body/f_search.htm#search"><B>SEARCH</B></A> "F" "FOO")<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
To keep data flow between programs from becoming excessively complicated,<P>
|
|
it's a good idea to specify what the default values are so that they can<P>
|
|
be passed explicitly rather than requiring an alternate calling sequence<P>
|
|
for all possible cases where the value might need to default.<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
Symbolics Genera implements the proposed behavior.<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
Hopefully most implementations already do this. Those that do not will<P>
|
|
probably have to make quite a number of small changes to both the code<P>
|
|
for these functions and to any associated compiler optimizers.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
This change is upward compatible with existing user code. Any program<P>
|
|
which did not conform to this proposal was already not portable.<P>
|
|
<P>
|
|
<B>Cost of Non-Adoption:<P>
|
|
</B><P>
|
|
Subtle gratuitous differences in the handling of these arguments would<P>
|
|
continue to be a possibility and a barrier to portability.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
The language would be more regular and well-defined.<P>
|
|
<P>
|
|
<B>Aesthetics:<P>
|
|
</B><P>
|
|
If it makes things clearer, it's an improvement.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
Pitman supports <A HREF="iss284.htm">RANGE-OF-START-AND-END-PARAMETERS:INTEGER-AND-INTEGER-NIL</A>.<P>
|
|
<P>
|
|
</PRE>
|
|
<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>
|