From: Erik Naggum
Subject: Re: sequence questions
Date: 
Message-ID: <3142072609564939@naggum.no>
* ·····@sip.medizin.uni-ulm.de (kp gores)
| isn't subseq supposed to give me the subsequence starting at 3rd element
| to the 5th??

  START and END arguments extract (or cause the function apply to) elements
  whose index, i, satisfies  START <= i < END.  this does perhaps make more
  sense if you consider the default, that END = NIL means the length of the
  sequence.

#:Erik
-- 
  suppose we blasted all politicians into space.
  would the SETI project find even one of them?
From: Kent M Pitman
Subject: Re: sequence questions
Date: 
Message-ID: <sfwemhunogv.fsf@world.std.com>
Erik Naggum <····@naggum.no> writes:

> * ·····@sip.medizin.uni-ulm.de (kp gores)
> | isn't subseq supposed to give me the subsequence starting at 3rd element
> | to the 5th??

"below", not "to".  END values are EXCLUSIVE bounds, while start values
are INCLUSIVE bounds.
 
>   START and END arguments extract (or cause the function apply to) elements
>   whose index, i, satisfies  START <= i < END.  this does perhaps make more
>   sense if you consider the default, that END = NIL means the length of the
>   sequence.

Right.  This issue is common to most languages that "count from 0".
Languages that count from 1 tend to use "from a to b" to mean a inclusive
to b inclusive, since natural number counting of five elements begins
at 1 and ends at 5.  But whole number counting of five elements beings at
0 and ends up at 4, so [as Erik notes], a length-5 sequence will have 
elements numbered from 0 to 4, so you want
 :end (length sequence)
to mean stop at the end [that is, 4, not 5].  Consequently,
:end designates a number one greater than the last index, exactly to keep
every :end argument in the universe from having to do
 :end (- (length sequence) 1)

The langauge definition doesn't NEED a reason; languages can be
defined for arbitrary reasons to be however the designer wants.  But
often there is an underlying reason, as is the case here and in most
computer languages, even though those languages differ.  I've said
many times--languages are ecologies.  What makes sense depends
on how you're going to use it.  Here we see a "food chain" relationship
between the decision to number indexes from 0 and the decision of using
an exclusive upper bound in sequence selectors; languages that use 
numbering from 1 use inclusive upper bounds.  But both are internally
consistent.  A language that used numbering from 1 but exclusive upper
bounds or numbering from 0 but inclusive upper bounds would be more suspect,
I think.

Hope this motivational background information is helpful.