[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug involving VECTOR-PUSH-EXTEND



Beg to differ (though only a little).  Apparently, KCL uses the
current size of the vector as the default extension (must be in the
report some place).  Of course, extending a vector of size zero by
zero elements still causes trouble.  CLtL only says that, in the
absence of a third argument "it defaults to a ``reasonable''
implementation-dependent value".  Whether using the current size is
``reasonable'' can be left to discussion.  See:

      KCl (Kyoto Common Lisp)  June 3, 1987
      ...

      >(setq  v (make-array 0 :fill-pointer 0 :adjustable t))
      #()

      >(vector-push-extend 1 v)

      Error: The index, 0, too large.
      Error signalled by VECTOR-PUSH-EXTEND.

      Broken at VECTOR-PUSH-EXTEND.  Type :H for Help.
      >>:q

      Top level.
      >(vector-push-extend 1 v 10)
      0


I have had this problem before.  The way I handle it is through the
fill-pointer.  Say
    (make-array <random, non-0 initial size> :fill-pointer 0 :adjustable t)
and the problem will go away.  (Allocating 1 element for an
adjustable array is not so bad.) Alternatively, get used to
supplying a third argument to vector-push-extend (a practice that
gives you better control anyway).  Hope this helps.

=Cesar
--------
Cesar Augusto  Quiroz Gonzalez

Department of Computer Science     ...allegra!rochester!quiroz
University of Rochester            or
Rochester,  NY 14627               quiroz@cs.rochester.edu