[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
propose deprecation of generalized-vector-*
From: |
Daniel Llorens |
Subject: |
propose deprecation of generalized-vector-* |
Date: |
Tue, 18 Sep 2012 16:49:39 +0200 |
Hello,
today I filed a bug on generalized-vector->list
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12465
I remember similar bugs in the past, and I'm thinking that these functions are
redundant since we have array-ref, array->list, and so on, which also work on
strings, uniform vectors, etc.
The only generalized-vector-? function that doesn't have a direct array-?
correspondence is generalized-vector-length. However, even for arrays of rank >
1 it is often convenient to have a function such as
(array-length a) = (car (array-dimensions a))
or maybe
(array-length a) = (fold * 1 (array-dimensions a))
Personally I'd favor the first as there's nothing to compute, but either would
work to replace generalized-vector-length.
Possible objections:
— generalized-vector-? may be marginally faster than array-?
Both need to do a bunch of type checks and dispatching, and
generalized-vector-? needs to check rank anyway, so I'm guessing this doesn't
matter. We could do some benchmarking.
— generalized-vector-? acts as an extra check on rank
array-ref will flag rank errors, so this objection applies only to -length and
->list. I do not think this is important because it's usually clear from the
code whether you're dealing with arrays of rank > 1 or not. But on this I'd
like to hear from users of generalized-vector-?.
TLDR, I propose to remove the generalized-vector-? functions since the array-?
set can replace them.
Regards,
Daniel
- propose deprecation of generalized-vector-*,
Daniel Llorens <=