VECTOR-UNFOLD and VECTOR-TABULATE
campbell@xxxxxx 20 Feb 2004 00:05 UTC
It occurred to me earlier today that VECTOR-UNFOLD is _not_ an
inherently silly operation; it's just a VECTOR-UNFOLD that does not
produce a fixed-size vector that's silly. Indeed, if the size of the
resulting vector is fixed at the time VECTOR-UNFOLD is applied, it is
VECTOR-TABULATE that is a silly operation, as it is trivially written
in terms of VECTOR-UNFOLD, but VECTOR-UNFOLD is much more general.
So I'd like to flush VECTOR-TABULATE in favour of VECTOR-UNFOLD:
(VECTOR-UNFOLD <f> <length> <initial-seed> ...) -> [seed ...]
(F <integer> <seed> ...) -> [new-seed ...]
The fundamental vector constructor. Create a vector whose length
is LENGTH and iterate across each index I between 0 and LENGTH,
applying F to I and the current seeds, initializing the Ith slot in
the new vector to the first value that F returned and continuing on
with the seeds becoming the other values that F returned.
VECTOR-TABULATE is just VECTOR-UNFOLD but with no seeds.
While I'm at it, I'd like to add VECTOR-UNFOLD-RIGHT again.
Objections?