Daniel Hartwig <mand...@gmail.com> writes:

> On 11 June 2012 17:01, Daniel Hartwig <mand...@gmail.com> wrote:
>> For reference, attached is a growable vector I use in several
>> projects, adapted to support the length operation similar to Lua (i.e.
>> first unset numerical index).  There is no catching of exceptions
>> here, every access to the data is through the dynvector procedures
>> which check the index and vector size.
>
> Always test before posting even small changes to existing code :-)
>
> Updated attachment to actually run without problems

Well, considering the cost of dynvector-grow!, doing the growth in a
loop rather then just the determination of the new size seems a bit
expensive:

  (while (<= (dynvector-capacity dynvector) k)
    (dynvector-grow! dynvector))

-- 
David Kastrup


Reply via email to