[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th e
From: |
MON KEY |
Subject: |
bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element |
Date: |
Fri, 20 Aug 2010 14:01:31 -0400 |
On Thu, Aug 19, 2010 at 10:23 PM, Juanma Barranquero <address@hidden> wrote:
> On Fri, Aug 20, 2010 at 04:01, MON KEY <address@hidden> wrote:
>
>> Emacs lisp doesn't and I can think of no good reasons to create 0
>> length bool-vectors.
>>
>> Can any one else?
>
> Of course. Eliminating special cases, for example.
>
Thank you for taking the time to provide this example. If you look
back you may notice I've already acknowledged that there is indeed
utility in 0 length vectors, e.g.:
,----
| I can imagine there are situations where making 0 length vanilla
| vector has utility because these are "closer" to list representation
| w/re the _type_ of contents they can hold and can be reasonable
| coerced w/ less representational loss of data but this is not the
| case w/ bool-vectors because they are _limited_ by the type of data
| they can represenet.
`----
And, I gave an example of the pathology:
,----
| (let* ((ab (make-bool-vector 1 t))
| (abeq (cons ab ab)))
| (concat (car abeq) (cdr abeq)))
| ;
| ;=> Debugger entered--Lisp error: (wrong-type-argument integerp t)
`----
> (defun split-vec (v p)
> (list (substring v 0 p)
> (substring v p (length v))))
>
Where is the boole-vector ???
(substring (make-bool-vector 18 t) 0)
;=> Debugger entered--Lisp error: (wrong-type-argument arrayp #&18"\377\377")
My question was _specifcally_ w/re to bool-vectors
one _can not_ take the substring of a bool-vector.
> and you can do
>
> (apply 'vconcat (split-vec V N))
>
> for N in -length(V)..length(V) and get back V
FWIW, your friendly (mis)interpreation of the issue helps bolster my
position... Which is (in part) that it isn't at all obvious that a
bool-vector is not _really_ a vector and behaves differently in most
respects from other the vector-likes.
Your example works for neither 0 length bool-vectors:
(apply 'vconcat (split-vec (make-bool-vector 0 t) 9))
;=> Debugger entered--Lisp error: (wrong-type-argument arrayp #&0"")
Nor the less pathological variety:
(apply 'vconcat (split-vec (make-bool-vector 18 t) 9))
;=> Debugger entered--Lisp error: (wrong-type-argument arrayp #&18"\377\377")
>
> Juanma
--
/s_P\
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, (continued)
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, Stefan Monnier, 2010/08/19
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, MON KEY, 2010/08/19
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, Stefan Monnier, 2010/08/19
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, Andreas Schwab, 2010/08/19
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, Chong Yidong, 2010/08/19
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, MON KEY, 2010/08/19
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, Juanma Barranquero, 2010/08/19
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, Chong Yidong, 2010/08/19
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, MON KEY, 2010/08/19
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, Juanma Barranquero, 2010/08/19
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element,
MON KEY <=
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, Juanma Barranquero, 2010/08/20
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, MON KEY, 2010/08/20
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, Stefan Monnier, 2010/08/20
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, MON KEY, 2010/08/20
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, Kevin Rodgers, 2010/08/21
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, Andreas Schwab, 2010/08/21
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, MON KEY, 2010/08/21
- bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element, Andreas Schwab, 2010/08/18