From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: MON KEY Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <87r5hutw2q.fsf@stupidchicken.com> <87fwyauqwy.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1282327764 27774 80.91.229.12 (20 Aug 2010 18:09:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 20 Aug 2010 18:09:24 +0000 (UTC) Cc: cyd@stupidchicken.com, schwab@linux-m68k.org, 6878@debbugs.gnu.org To: Juanma Barranquero Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 20 20:09:21 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OmW1j-0005tw-1L for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Aug 2010 20:09:15 +0200 Original-Received: from localhost ([127.0.0.1]:41315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OmW1h-0001UK-Pg for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Aug 2010 14:09:13 -0400 Original-Received: from [140.186.70.92] (port=41296 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OmW1Z-0001TU-7M for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2010 14:09:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OmW1Y-0003tw-1j for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2010 14:09:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50726) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmW1Y-0003tr-00 for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2010 14:09:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OmVtm-0003z2-5v; Fri, 20 Aug 2010 14:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: MON KEY Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Aug 2010 18:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6878 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6878-submit@debbugs.gnu.org id=B6878.128232722415168 (code B ref 6878); Fri, 20 Aug 2010 18:01:02 +0000 Original-Received: (at 6878) by debbugs.gnu.org; 20 Aug 2010 18:00:24 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmVtA-0003wa-2Y for submit@debbugs.gnu.org; Fri, 20 Aug 2010 14:00:24 -0400 Original-Received: from mail-ww0-f46.google.com ([74.125.82.46]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmVt8-0003ki-BZ for 6878@debbugs.gnu.org; Fri, 20 Aug 2010 14:00:22 -0400 Original-Received: by wwb22 with SMTP id 22so4476020wwb.15 for <6878@debbugs.gnu.org>; Fri, 20 Aug 2010 11:01:32 -0700 (PDT) Original-Received: by 10.227.69.134 with SMTP id z6mr1507880wbi.201.1282327291871; Fri, 20 Aug 2010 11:01:31 -0700 (PDT) Original-Received: by 10.216.65.140 with HTTP; Fri, 20 Aug 2010 11:01:31 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: oea0ilEq8gi1Iu1iDax6yqtIxCs X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 20 Aug 2010 14:01:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:39667 Archived-At: On Thu, Aug 19, 2010 at 10:23 PM, Juanma Barranquero wro= te: > On Fri, Aug 20, 2010 at 04:01, MON KEY 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))) | ; | ;=3D> 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) ;=3D> Debugger entered--Lisp error: (wrong-type-argument arrayp #&18"\377\3= 77=03") 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)) ;=3D> Debugger entered--Lisp error: (wrong-type-argument arrayp #&0"") Nor the less pathological variety: (apply 'vconcat (split-vec (make-bool-vector 18 t) 9)) ;=3D> Debugger entered--Lisp error: (wrong-type-argument arrayp #&18"\377\3= 77=03") > > Juanma -- /s_P\