> >Are you sure using lists instead of vectors is the right thing to do?
> > Lists are linked lists and as such accessing the i'th element is O(i). In
> > vectors it is O(1). This can cause an order of complexity increase in
> > handling them.
This is true, but not much of a problem, since most scripts only use either
the first 1 or 2 elements of arrays or work on typically very short arrays,
or want to pass a (short) array to PDB, where there is no difference between
list-construction and setting every element of a vector explicitly (the
latter possibly being even more inefficient).
> No, I'm not sure. For the few scripts I looked at (and for ease of
> implementation), using a list was the easier route to have something
> functional during the early development stages. Using vectors instead of a
> simple list would mean the ability to use functions which would provide
> rough equivalents to the SIOD interpreters array manipulation functions.
As I understand it, there are even *exact* equivalents to the current "array"
type. No wonder, since a Lisp vector is a special case of an array
(one-dimensional). In Script-Fu, "arrays" are indeed vectors.
> I will take a closer look at using vectors. It will simplify the work
> needed to update old Script-Fu scripts for use with Tiny-Fu. I will start
> by converting between list and vector. If the approach works well, I will
> bit the bullet and update the marshalling code to use vectors for the
> *ARRAY types.
I also opt for vector because apart from being the natural Scheme equivalent
to PDB's one-dimensional arrays, it makes writing plug-ins easier for people
that have no to little practice in converting common "for/while" loops using
tail-recursion, and current scripts would work practically unmodified,
without explicit conversions list->vector that would only cost time (with
everybody ending up calling these instead of working on lists most of the
Gimp-developer mailing list