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

Too much of a good thing?



I completely agree with all "remove this" comments made by Michael Burschik.

<Flame>

I think that most of the operations that generate vectors element-by-element
are useless, especially when the performance is the same as in making a list
first and then turning it into a vector. The reason for the existence of
vectors
is constant-time access by index and smaller memory footprint; everything
else is better done with lists. Having one humongous SRFI for lists pretty
much solves the problem; there is no need to replicate it for every "linear"
data structure. What Scheme needs is more orthogonality, not less, and
this SRFI (together with large part of Olin's string-lib) just adds more
names,
not more functionality. Orthogonal approach is to abstract over the
concept of "sequence" (this is not the same as giving "generic" versions
of all the functions with switch by pair? / string? / vector?) and have
a good SRFI for high-order functions like COMPOSE, NEGATE,
CURRY, BIND, etc. Only in places where sequences are different
from each other do we need new functions; in case of vectors, they
support effective direct access to / modification of content.

I suggest to drop everything that is not related to the main purpose
of vector's existance: constant-time indexed access. Here's what I
would left (in addition to what's already in Scheme):

vector-tabulate
vector-copy!
vector-append
vector-reverse!
vector-fold{-right}
vector-unfold{-right}
vector-map!
vector-map/index!
vector-for-each{-right}
vector-index{-right}
vector-skip{-right}
vector-fill! ;extended version

</Flame>


It would also be nice to have in-place versions
of insert/delete where insert drops elements
off the tail while delete shifts in an (optional)
new value. Left/right and circular shifts are also
useful.

-- Sergei