From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 18 00:18:43 2010 Received: (at submit) by debbugs.gnu.org; 18 Aug 2010 04:18:43 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ola6s-0005FC-82 for submit@debbugs.gnu.org; Wed, 18 Aug 2010 00:18:43 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ola6r-0005F2-85 for submit@debbugs.gnu.org; Wed, 18 Aug 2010 00:18:41 -0400 Received: from lists.gnu.org ([199.232.76.165]:33037) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ola7s-0007f2-Nl for submit@debbugs.gnu.org; Wed, 18 Aug 2010 00:19:44 -0400 Received: from [140.186.70.92] (port=58679 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ola7r-0002Ok-8a for bug-gnu-emacs@gnu.org; Wed, 18 Aug 2010 00:19:44 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ola7q-0004dX-5f for bug-gnu-emacs@gnu.org; Wed, 18 Aug 2010 00:19:43 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:35794) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ola7p-0004dT-W1 for bug-gnu-emacs@gnu.org; Wed, 18 Aug 2010 00:19:42 -0400 Received: by wyg36 with SMTP id 36so287197wyg.0 for ; Tue, 17 Aug 2010 21:19:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.157.13 with SMTP id n13mr6564201wek.35.1282105178202; Tue, 17 Aug 2010 21:19:38 -0700 (PDT) Received: by 10.216.65.140 with HTTP; Tue, 17 Aug 2010 21:19:38 -0700 (PDT) Date: Wed, 18 Aug 2010 00:19:38 -0400 X-Google-Sender-Auth: dVpr6VwZ9nE-8W5NEWSBfW_kmCY Message-ID: Subject: bool-vectors of length 0 signal error when aref/aset the 0th element From: MON KEY To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.1 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.2 (-----) When aref/aset'ing the 0th element of a bool-vectors of length 0 i get an args-out-of-range error: (setq tt--bv (make-bool-vector 29 t)) ;=3D> #&29"\377\377\377=1F" (vconcat (make-bool-vector 29 t)) ; =3D> [t { ... 27 t's ... } t] (aref tt--bv 0) ;=3D> t (aset tt--bv 0 nil) ;=3D> nil (setq tt--bv (make-bool-vector 0 t)) ;=3D> #&0"" (vconcat (make-bool-vector 0 t)) ;=3D> [] (aref tt--bv 0) ;=3D> Debugger entered--Lisp error: (args-out-of-range #&0"" 0) (aset tt--bv 0 t) ;=3D> Debugger entered--Lisp error: (args-out-of-range #&0"" 0) As with the the first bool-vector of length 29 the second bool-vector of length 0 should also have a value at element 0 that evaluates to `t'. (Or, it should according to the manual): ,---- (info "(elisp)Bool-Vector Type") | | "A "bool-vector" is a one-dimensional array of elements that must be | `t' or `nil'." | `---- I can't find mention in the docs that the 0th element of a bool-vector is void for 0 length bool-vectors. Indeed, it isn't at all clear why it should. I find this is problematic because there aren't any equivalents to `car-safe'/`safe-length' for generalized bool-vectors operations. Obv. taking the 0th index of a vector or char-table also signals an args-out-of-range error however I belive this for slightly different reasons. (setq tt--mv (make-vector 0 t)) ;=3D> [] (vectorp tt--mv) ;=3D> t (vectorp tt--bv) ;=3D> nil (char-table-p tt--bv) ;=3D> nil (vector-or-char-table-p tt--bv) ;=3D> nil (arrayp tt--bv) ;=3D> t (bool-vector-p tt--bv) ;=3D> t (null tt--bv) ;=3D> nil (null (append tt--bv)) ;=3D> nil (null (append tt--bv nil)) ;=3D> t Maybe something like this is needed: (defun safe-aref-bool-vector (bool-vector idx) (if (and (bool-vector-p bool-vector) (not (null (append bool-vector nil)))) (aref bool-vector idx) 0)) (defun safe-aset-bool-vector (bool-vector idx) (if (and (bool-vector-p bool-vector) (not (null (append bool-vector nil)))) (aset bool-vector idx) 0)) From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 18 03:35:56 2010 Received: (at 6878) by debbugs.gnu.org; 18 Aug 2010 07:35:56 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OldBk-00083B-Ay for submit@debbugs.gnu.org; Wed, 18 Aug 2010 03:35:56 -0400 Received: from impaqm4.telefonica.net ([213.4.138.4]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OldBh-000831-Lj for 6878@debbugs.gnu.org; Wed, 18 Aug 2010 03:35:54 -0400 Received: from IMPmailhost5.adm.correo ([10.20.102.126]) by IMPaqm4.telefonica.net with bizsmtp id vhoG1e0092jdgqJ3Qjcwe5; Wed, 18 Aug 2010 09:36:56 +0200 Received: from ceviche.home ([83.61.35.93]) by IMPmailhost5.adm.correo with BIZ IMP id vjcv1e00920aCvn1ljcwLH; Wed, 18 Aug 2010 09:36:56 +0200 X-Brightmail-Tracker: AAAAAA== X-TE-authinfo: authemail="monnier$movistar.es" |auth_email="monnier@movistar.es" X-TE-AcuTerraCos: auth_cuTerraCos="cosuitnetc01" Received: by ceviche.home (Postfix, from userid 20848) id 8975E660F0; Wed, 18 Aug 2010 09:36:55 +0200 (CEST) From: Stefan Monnier To: MON KEY Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element Message-ID: References: Date: Wed, 18 Aug 2010 09:36:55 +0200 In-Reply-To: (MON KEY's message of "Wed, 18 Aug 2010 00:19:38 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 6878 Cc: 6878@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > When aref/aset'ing the 0th element of a bool-vectors of length 0 i get > an args-out-of-range error: To have a 0th element, an array needs to be of length >= 1. So this behavior seems perfectly correct to me. An array of length N has elements 0..N-1, so an array of length 0 doesn't have any elements at all. This should be true of strings, vectors, and bool-vectors. Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 18 04:35:40 2010 Received: (at 6878) by debbugs.gnu.org; 18 Aug 2010 08:35:40 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ole7X-0000Wz-QP for submit@debbugs.gnu.org; Wed, 18 Aug 2010 04:35:40 -0400 Received: from mail-out.m-online.net ([212.18.0.9]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ole7W-0000Wq-DK for 6878@debbugs.gnu.org; Wed, 18 Aug 2010 04:35:39 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 98BD81C159E8; Wed, 18 Aug 2010 10:36:41 +0200 (CEST) Received: from hase.home (ppp-93-104-148-222.dynamic.mnet-online.de [93.104.148.222]) by mail.mnet-online.de (Postfix) with ESMTP id 058B01C002B8; Wed, 18 Aug 2010 10:36:40 +0200 (CEST) From: Andreas Schwab To: MON KEY Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element References: X-Yow: TAILFINS!! ...click... Date: Wed, 18 Aug 2010 10:36:40 +0200 In-Reply-To: (MON KEY's message of "Wed, 18 Aug 2010 00:19:38 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 6878 Cc: 6878@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) MON KEY writes: > As with the the first bool-vector of length 29 the second bool-vector > of length 0 should also have a value at element 0 that evaluates to > `t'. (Or, it should according to the manual): There is no element 0 in a 0-length bool vector, just like there is no element 29 in a 29-length bool vector. > Obv. taking the 0th index of a vector or char-table also signals an > args-out-of-range error however I belive this for slightly different > reasons. In which way are bool vectors different from other vectors? Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 18 21:50:06 2010 Received: (at 6878) by debbugs.gnu.org; 19 Aug 2010 01:50:06 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OluGc-0001H5-9f for submit@debbugs.gnu.org; Wed, 18 Aug 2010 21:50:06 -0400 Received: from mail-wy0-f172.google.com ([74.125.82.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OluGZ-0001Gg-KG for 6878@debbugs.gnu.org; Wed, 18 Aug 2010 21:50:04 -0400 Received: by wyb40 with SMTP id 40so1470112wyb.3 for <6878@debbugs.gnu.org>; Wed, 18 Aug 2010 18:51:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.44.209 with SMTP id n59mr86085web.58.1282182669100; Wed, 18 Aug 2010 18:51:09 -0700 (PDT) Received: by 10.216.65.140 with HTTP; Wed, 18 Aug 2010 18:51:09 -0700 (PDT) In-Reply-To: References: Date: Wed, 18 Aug 2010 21:51:09 -0400 X-Google-Sender-Auth: Ag93yKGBs2fuJGuGB836gGWfdU0 Message-ID: Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element From: MON KEY To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 6878 Cc: Andreas Schwab , 6878@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.2 (---) On Wed, Aug 18, 2010 at 3:36 AM, Stefan Monnier wrote: >> When aref/aset'ing the 0th element of a bool-vectors of length 0 i get >> an args-out-of-range error: > To have a 0th element, an array needs to be of length >= 1. Sure, this is true in the generalized case for an Elisp array. > An array of length N has elements 0..N-1, so an array of length > 0 doesn't have any elements at all. Maybe, but this is not what the manual has to say of the particular type of array that is a bool-vector, again (note the "must"): ,---- (info "(elisp)Bool-Vector Type") | | "A "bool-vector" is a one-dimensional array of elements that must be `t' | or `nil'." | `---- So why would/should Emacs let me create a bool-vectors that I can neither set nor get without signalling an error? 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. Coercing 0 length bool-vector returns a bool-vector whereas coercing a like vanilla vector yields a vector e.g.: (append (make-bool-vector 0 t) '()) ;=> #&0"" (append (make-vector 0 1)) ;=> [] This presents a presents a problem when one _expects_ a bool-vector to be treated as a first class array: (let* ((ab (make-bool-vector 0 t)) (abeq (cons ab ab))) (concat (car abeq) (cdr abeq))) ;=> "" (let* ((av (make-vector 0 0)) (aveq (cons av av))) (concat (car aveq) (cdr aveq))) ;=> "" Indeed, if we are to believe the above return values the coercion results in two return values which _are_ `eq': (let* ((ab (make-bool-vector 0 t)) (abeq (cons ab ab)) (av (make-vector 0 0)) (aveq (cons av av))) (eq (concat (car abeq) (cdr abeq)) (concat (car aveq) (cdr abeq)))) ;=> t However apropos Andreas' question: > In which way are bool vectors different from other vectors? Andreas, if your listening this is how: This works: (let* ((ab (make-vector 1 116)) (aseq (cons ab ab))) (concat (car aseq) (cdr aseq))) ;=> "tt" This doesn't: (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) Honestly I can't find the utility of 0 length bool-vectors in a lisp system which doesn't allow tweaking arrays at a lower level than Emacs presently allows. Maybe bool-vectors were intended (at some point long ago) to be (or to be eventually) made adjustable :) : CL-USER> (setq ba (make-array 0 :element-type 'bit :adjustable t)) CL-USER> ba #* CL-USER> (adjustable-array-p ba) T CL-USER> (array-dimension ba 0) 0 CL-USER> (array-dimensions ba) (0) CL-USER> (adjust-array ba 1) #*0 CL-USER> ba #*0 CL-USER> (bit-vector-p ba) T CL-USER> (bit ba 0) 0 (setf (bit ba 0) 1) 1 CL-USER> (bit ba 0) 1 CL-USER> ba #*1 -- /s_P\ From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 04:41:00 2010 Received: (at 6878) by debbugs.gnu.org; 19 Aug 2010 08:41:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om0gF-0003wO-RM for submit@debbugs.gnu.org; Thu, 19 Aug 2010 04:41:00 -0400 Received: from mail-out.m-online.net ([212.18.0.9]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om0gE-0003wI-6m for 6878@debbugs.gnu.org; Thu, 19 Aug 2010 04:40:59 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 882A11C159D7; Thu, 19 Aug 2010 10:42:03 +0200 (CEST) Received: from hase.home (ppp-93-104-135-151.dynamic.mnet-online.de [93.104.135.151]) by mail.mnet-online.de (Postfix) with ESMTP id D43B81C0010B; Thu, 19 Aug 2010 10:42:02 +0200 (CEST) From: Andreas Schwab To: MON KEY Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element References: X-Yow: Now that we're in LOVE, you can BUY this GOLDFISH for a 48% DISCOUNT. Date: Thu, 19 Aug 2010 10:42:02 +0200 In-Reply-To: (MON KEY's message of "Wed, 18 Aug 2010 21:51:09 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 6878 Cc: Stefan Monnier , 6878@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) MON KEY writes: > Maybe, but this is not what the manual has to say of the particular type of > array that is a bool-vector, again (note the "must"): > > ,---- (info "(elisp)Bool-Vector Type") > | > | "A "bool-vector" is a one-dimensional array of elements that must be `t' > | or `nil'." All elements of (make-bool-vector 0 t) are either t or nil. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 10:12:38 2010 Received: (at 6878) by debbugs.gnu.org; 19 Aug 2010 14:12:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om5rB-0006t5-SS for submit@debbugs.gnu.org; Thu, 19 Aug 2010 10:12:38 -0400 Received: from mail-fx0-f44.google.com ([209.85.161.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om5r9-0006t0-OB for 6878@debbugs.gnu.org; Thu, 19 Aug 2010 10:12:36 -0400 Received: by fxm18 with SMTP id 18so1060056fxm.3 for <6878@debbugs.gnu.org>; Thu, 19 Aug 2010 07:13:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.138.65 with SMTP id z43mr8416207wei.12.1282227222348; Thu, 19 Aug 2010 07:13:42 -0700 (PDT) Received: by 10.216.65.140 with HTTP; Thu, 19 Aug 2010 07:13:42 -0700 (PDT) In-Reply-To: References: Date: Thu, 19 Aug 2010 10:13:42 -0400 X-Google-Sender-Auth: -FoA8YTrxHvUOQALC7p1l44ZnPg Message-ID: Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element From: MON KEY To: 6878@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 6878 Cc: Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) On Thu, Aug 19, 2010 at 4:42 AM, Andreas Schwab wrote: >> ,---- (info "(elisp)Bool-Vector Type") >> | >> | "A "bool-vector" is a one-dimensional array of elements that must be `t' >> | or `nil'." > > All elements of (make-bool-vector 0 t) are either t or nil. > Prove it! Please provide one piece of code that explicitly allows accessing the `t' at elt 0 and/or distinguishing whether the elt at idx 0 is either `t' or `nil'. I can't find a way to do it. Can you? In the absence of a working example I think you have a bug on your hands. > Andreas. -- /s_P\ From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 10:46:34 2010 Received: (at 6878) by debbugs.gnu.org; 19 Aug 2010 14:46:34 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om6O1-00079O-JP for submit@debbugs.gnu.org; Thu, 19 Aug 2010 10:46:33 -0400 Received: from impaqm2.telefonica.net ([213.4.138.2]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om6Nz-00079G-0C for 6878@debbugs.gnu.org; Thu, 19 Aug 2010 10:46:31 -0400 Received: from IMPmailhost4.adm.correo ([10.20.102.125]) by IMPaqm2.telefonica.net with bizsmtp id wD9l1e00A2iL0W23MEndJM; Thu, 19 Aug 2010 16:47:37 +0200 Received: from ceviche.home ([83.61.35.93]) by IMPmailhost4.adm.correo with BIZ IMP id wEnc1e00320aCvn1kEncqK; Thu, 19 Aug 2010 16:47:37 +0200 X-Brightmail-Tracker: AAAAAA== X-TE-authinfo: authemail="monnier$movistar.es" |auth_email="monnier@movistar.es" X-TE-AcuTerraCos: auth_cuTerraCos="cosuitnetc01" Received: by ceviche.home (Postfix, from userid 20848) id 43A81660E9; Thu, 19 Aug 2010 16:47:36 +0200 (CEST) From: Stefan Monnier To: Andreas Schwab Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element Message-ID: References: Date: Thu, 19 Aug 2010 16:47:36 +0200 In-Reply-To: (Andreas Schwab's message of "Thu, 19 Aug 2010 10:42:02 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 6878 Cc: MON KEY , 6878@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> Maybe, but this is not what the manual has to say of the particular type of >> array that is a bool-vector, again (note the "must"): >> ,---- (info "(elisp)Bool-Vector Type") >> | "A "bool-vector" is a one-dimensional array of elements that must be `t' >> | or `nil'." > All elements of (make-bool-vector 0 t) are either t or nil. Indeed, this is trivially (and vacuously) true. Actually, we can even say that all elements of a 0-length vector (bool or not) are both nil and t at the same time. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 11:03:39 2010 Received: (at 6878) by debbugs.gnu.org; 19 Aug 2010 15:03:39 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om6eY-0007GQ-Mg for submit@debbugs.gnu.org; Thu, 19 Aug 2010 11:03:38 -0400 Received: from mail-out.m-online.net ([212.18.0.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om6eW-0007GL-4w for 6878@debbugs.gnu.org; Thu, 19 Aug 2010 11:03:36 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 8D3A21C0042A; Thu, 19 Aug 2010 17:04:42 +0200 (CEST) Received: from hase.home (ppp-93-104-135-151.dynamic.mnet-online.de [93.104.135.151]) by mail.mnet-online.de (Postfix) with ESMTP id 11EA31C00334; Thu, 19 Aug 2010 17:04:41 +0200 (CEST) From: Andreas Schwab To: Stefan Monnier Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element References: X-Yow: Yes, Private DOBERMAN!! Date: Thu, 19 Aug 2010 17:04:41 +0200 In-Reply-To: (Stefan Monnier's message of "Thu, 19 Aug 2010 16:47:36 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 6878 Cc: MON KEY , 6878@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >>> Maybe, but this is not what the manual has to say of the particular type of >>> array that is a bool-vector, again (note the "must"): >>> ,---- (info "(elisp)Bool-Vector Type") >>> | "A "bool-vector" is a one-dimensional array of elements that must be `t' >>> | or `nil'." >> All elements of (make-bool-vector 0 t) are either t or nil. > > Indeed, this is trivially (and vacuously) true. Actually, we can even > say that all elements of a 0-length vector (bool or not) are both nil > and t at the same time. As long as you don't look at them ;-) Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 11:50:59 2010 Received: (at 6878) by debbugs.gnu.org; 19 Aug 2010 15:50:59 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om7ON-0007bw-6D for submit@debbugs.gnu.org; Thu, 19 Aug 2010 11:50:59 -0400 Received: from impaqm5.telefonica.net ([213.4.138.5]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om7OK-0007br-KJ for 6878@debbugs.gnu.org; Thu, 19 Aug 2010 11:50:57 -0400 Received: from IMPmailhost6.adm.correo ([10.20.102.127]) by IMPaqm5.telefonica.net with bizsmtp id wErq1e00A2kvMAa3RFrstb; Thu, 19 Aug 2010 17:51:52 +0200 Received: from ceviche.home ([83.61.35.93]) by IMPmailhost6.adm.correo with BIZ IMP id wFrr1e00620aCvn1mFrrjQ; Thu, 19 Aug 2010 17:51:52 +0200 X-Brightmail-Tracker: AAAAAA== X-TE-authinfo: authemail="monnier$movistar.es" |auth_email="monnier@movistar.es" X-TE-AcuTerraCos: auth_cuTerraCos="cosuitnetc01" Received: by ceviche.home (Postfix, from userid 20848) id 30B22660E9; Thu, 19 Aug 2010 17:51:51 +0200 (CEST) From: Stefan Monnier To: MON KEY Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element Message-ID: References: Date: Thu, 19 Aug 2010 17:51:51 +0200 In-Reply-To: (MON KEY's message of "Thu, 19 Aug 2010 10:13:42 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 6878 Cc: 6878@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >>> ,---- (info "(elisp)Bool-Vector Type") >>> | "A "bool-vector" is a one-dimensional array of elements that must be = `t' >>> | or `nil'." >> All elements of (make-bool-vector 0 t) are either t or nil. > Prove it! Easy! formally, he said: =E2=88=80 n =E2=89=A5 0 =E2=88=A7 n < 0. (aref (make-bool-vector 0 t) n) = =E2=88=88 { nil, t } And since there is no such `n', this is trivially true. More specifically, "n =E2=89=A5 0 =E2=88=A7 n < 0" is a falsehood, and from= false you can conclude anything you wish. Among other things you can just a trivially prove: =E2=88=80 n =E2=89=A5 0 =E2=88=A7 n < 0. the sky is green -- Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 12:17:36 2010 Received: (at 6878) by debbugs.gnu.org; 19 Aug 2010 16:17:36 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om7o7-0007o6-CZ for submit@debbugs.gnu.org; Thu, 19 Aug 2010 12:17:35 -0400 Received: from pantheon-po44.its.yale.edu ([130.132.50.78]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om7o5-0007o1-UO for 6878@debbugs.gnu.org; Thu, 19 Aug 2010 12:17:34 -0400 Received: from furry ([64.134.97.210]) (authenticated bits=0) by pantheon-po44.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o7JGIcxV015970 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 19 Aug 2010 12:18:40 -0400 Received: by furry (Postfix, from userid 1000) id 63611C013; Thu, 19 Aug 2010 12:18:37 -0400 (EDT) From: Chong Yidong To: MON KEY Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element References: Date: Thu, 19 Aug 2010 12:18:37 -0400 In-Reply-To: (MON KEY's message of "Wed, 18 Aug 2010 21:51:09 -0400") Message-ID: <87r5hutw2q.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 6878 Cc: Andreas Schwab , Stefan Monnier , 6878@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) MON KEY writes: > So why would/should Emacs let me create a bool-vectors that I can > neither set nor get without signalling an error? You can vconcat them. From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 13:05:53 2010 Received: (at 6878) by debbugs.gnu.org; 19 Aug 2010 17:05:53 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om8Yr-00089O-5O for submit@debbugs.gnu.org; Thu, 19 Aug 2010 13:05:53 -0400 Received: from mail-ew0-f44.google.com ([209.85.215.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om8Yp-00089J-JG for 6878@debbugs.gnu.org; Thu, 19 Aug 2010 13:05:52 -0400 Received: by ewy22 with SMTP id 22so1392765ewy.3 for <6878@debbugs.gnu.org>; Thu, 19 Aug 2010 10:06:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.0.206 with SMTP id 56mr88437web.33.1282237618372; Thu, 19 Aug 2010 10:06:58 -0700 (PDT) Received: by 10.216.65.140 with HTTP; Thu, 19 Aug 2010 10:06:58 -0700 (PDT) In-Reply-To: References: Date: Thu, 19 Aug 2010 13:06:58 -0400 X-Google-Sender-Auth: 1ZXavvbSbfw-MQDx4qRwJznBbBM Message-ID: Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element From: MON KEY To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: 6878 Cc: Chong Yidong , Andreas Schwab , 6878@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) On Thu, Aug 19, 2010 at 11:51 AM, Stefan Monnier wrote: >> Prove it! > > Easy! formally, he said: > > =E2=88=80 n =E2=89=A5 0 =E2=88=A7 n < 0. (aref (make-bool-vector 0 t) n)= =E2=88=88 { nil, t } > > And since there is no such `n', this is trivially true. > More specifically, "n =E2=89=A5 0 =E2=88=A7 n < 0" is a falsehood, and fr= om false you > can conclude anything you wish. Among other things you can just > a trivially prove: > > =E2=88=80 n =E2=89=A5 0 =E2=88=A7 n < 0. the sky is green > The problem with the above semantic vodoo is that it doesn't reflect the contents of the manual either: ,---- (info "(elisp)bool-vectors") | | A bool-vector is much like a vector, except that it stores only the | values `t' and `nil'. If you try to store any non-`nil' value into an | element of the bool-vector, the effect is to store `t' there. | `---- Informally, your formal proof is valid only so long as we suspend belief in the manual and the sources which the manual is intended to inform, specifically the place where it doesn't say that 0 length bool-vectors don't have a value at index 0. IOW your proofs universal qualifer relies on an empty domain where the manual would suggest otherwise. Since there is no "formal Emacs Lisp specification", and since we are not discussing the formal realm of denotational semantics nor first order logic w/ regards to a formal Emacs Lisp specification your proof is indeed only trivially applicable. Here is what I think the manual should say: at info node "Bool-Vector Type" ,---- | | A "bool-vector" is a special type of one-dimensional array. An elment | of a bool-vector which is accesible by its non-zero index must only be | `t' or `nil'. | `---- at info node "Bool-vectors" ,---- | | A bool-vector is a special type of vector which stores only the values `t= ' | and `nil'. If you try to store any non-`nil' value into an element of th= e | bool-vector, the effect is to store `t' there. As with all arrays, | bool-vector indices start from 0. Emacs allows creation of a bool-vector = of | length 0 however its length cannot be changed once the bool-vector is cre= ated. | An error is singaled if you try to access the 0 index of a bool-vector of | length 0. Bool-vectors are constants when evaluated. | `---- -- /s_P\ From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 13:08:30 2010 Received: (at 6878) by debbugs.gnu.org; 19 Aug 2010 17:08:30 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om8bN-0008As-Ct for submit@debbugs.gnu.org; Thu, 19 Aug 2010 13:08:29 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om8bM-0008Am-AX for 6878@debbugs.gnu.org; Thu, 19 Aug 2010 13:08:28 -0400 Received: by wwb22 with SMTP id 22so2752099wwb.15 for <6878@debbugs.gnu.org>; Thu, 19 Aug 2010 10:09:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.71.132 with SMTP id r4mr911019wed.102.1282237775370; Thu, 19 Aug 2010 10:09:35 -0700 (PDT) Received: by 10.216.65.140 with HTTP; Thu, 19 Aug 2010 10:09:35 -0700 (PDT) In-Reply-To: <87r5hutw2q.fsf@stupidchicken.com> References: <87r5hutw2q.fsf@stupidchicken.com> Date: Thu, 19 Aug 2010 13:09:35 -0400 X-Google-Sender-Auth: jkzAc0yGnQNx_0gjfWWKqxOkFFc Message-ID: Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element From: MON KEY To: Chong Yidong Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 6878 Cc: Andreas Schwab , 6878@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) On Thu, Aug 19, 2010 at 12:18 PM, Chong Yidong wrote: > MON KEY writes: > >> So why would/should Emacs let me create a bool-vectors that I can >> neither set nor get without signalling an error? > > You can vconcat them. > Yep: (let* ((ab (make-bool-vector 1 t)) (abeq (cons ab ab))) (vconcat (car abeq) (cdr abeq))) ;=>[t t] But, again, where is the `t' or `nil'? (let* ((ab (make-bool-vector 0 t)) (abeq (cons ab ab))) (vconcat (car abeq) (cdr abeq))) ;=> [] The manual says a `t' or `nil' "must" be there. -- /s_P\ From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 14:39:33 2010 Received: (at 6878) by debbugs.gnu.org; 19 Aug 2010 18:39:33 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmA1V-0000Lb-5Y for submit@debbugs.gnu.org; Thu, 19 Aug 2010 14:39:33 -0400 Received: from mail-yw0-f44.google.com ([209.85.213.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmA1S-0000LV-S9 for 6878@debbugs.gnu.org; Thu, 19 Aug 2010 14:39:31 -0400 Received: by ywi4 with SMTP id 4so760139ywi.3 for <6878@debbugs.gnu.org>; Thu, 19 Aug 2010 11:40:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=Y6wdh9z0qaLKv3t/4oyaPsww543DEeaJ1txqTWmFck4=; b=jj/dC/qmEhWH5r6giHB37McbP3UHgE+L3sTiO6LQrC0oWsEuhe/XQ9qGC1ZnHnuadI T8f5avZUWonR73F9PRhHaZspvmfAm2BK0lmqdW7OklMAcOGVWq9DYCNOOvkcvOPVqRia 36ieBsTHBwDdpp0DFprHMcLrB+L+upuukuHIQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=SKwyxF1ISgWiRI1mVq2LPGyq0dh6QYx2lfjJSGiRRoXE9ANS9kexXd6F28PcVcJx+Q mxGYtaxWMmfWhxYN+RpUMJKMRybUnP37gur2rK/SYLc38oU+d/4bnwjFW1WH7ABUFDmL p48K2sFgrBPtdHDdlON15nDykMCOClbTzFpeU= Received: by 10.151.92.15 with SMTP id u15mr342365ybl.447.1282243238328; Thu, 19 Aug 2010 11:40:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.151.132 with HTTP; Thu, 19 Aug 2010 11:40:17 -0700 (PDT) In-Reply-To: References: <87r5hutw2q.fsf@stupidchicken.com> From: Juanma Barranquero Date: Thu, 19 Aug 2010 20:40:17 +0200 Message-ID: Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element To: MON KEY Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 6878 Cc: Chong Yidong , Andreas Schwab , 6878@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On Thu, Aug 19, 2010 at 19:09, MON KEY wrote: > But, again, where is the `t' or `nil'? > > (let* ((ab (make-bool-vector 0 t)) > =C2=A0 =C2=A0 =C2=A0(abeq (cons ab ab))) > =C2=A0(vconcat (car abeq) (cdr abeq))) > > ;=3D> [] > > The manual says a `t' or `nil' "must" be there. No, it says that its elements must be either t or nil. And they are, *all* of them. =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 19:23:42 2010 Received: (at 6878) by debbugs.gnu.org; 19 Aug 2010 23:23:42 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmESU-0002we-42 for submit@debbugs.gnu.org; Thu, 19 Aug 2010 19:23:42 -0400 Received: from pantheon-po23.its.yale.edu ([130.132.50.117]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmESS-0002wZ-9w for 6878@debbugs.gnu.org; Thu, 19 Aug 2010 19:23:40 -0400 Received: from furry ([64.134.97.210]) (authenticated bits=0) by pantheon-po23.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o7JNOkni001153 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 19 Aug 2010 19:24:48 -0400 Received: by furry (Postfix, from userid 1000) id 83904C013; Thu, 19 Aug 2010 19:24:45 -0400 (EDT) From: Chong Yidong To: MON KEY Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element References: <87r5hutw2q.fsf@stupidchicken.com> Date: Thu, 19 Aug 2010 19:24:45 -0400 In-Reply-To: (MON KEY's message of "Thu, 19 Aug 2010 13:09:35 -0400") Message-ID: <87fwyauqwy.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 6878 Cc: Andreas Schwab , 6878@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) MON KEY writes: > The manual says a `t' or `nil' "must" be there. Admittedly, the wording in the manual makes it possible for a reader to misinterpret it, if he is determined to do so. I have changed it to read A @dfn{bool-vector} is a one-dimensional array whose elements must be @code{t} or @code{nil}. which should be less ambiguous. Thus, I'm closing this bug. From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 19:28:04 2010 Received: (at control) by debbugs.gnu.org; 19 Aug 2010 23:28:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmEWi-0002yY-E4 for submit@debbugs.gnu.org; Thu, 19 Aug 2010 19:28:04 -0400 Received: from pantheon-po44.its.yale.edu ([130.132.50.78]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmEWh-0002yB-Fs for control@debbugs.gnu.org; Thu, 19 Aug 2010 19:28:03 -0400 Received: from furry ([64.134.97.210]) (authenticated bits=0) by pantheon-po44.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o7JNT8Hm024380 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 19 Aug 2010 19:29:11 -0400 Received: by furry (Postfix, from userid 1000) id 72260C013; Thu, 19 Aug 2010 19:29:07 -0400 (EDT) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 6878 Date: Thu, 19 Aug 2010 19:29:07 -0400 Message-ID: <87aaoifags.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) close 6878 thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 22:00:38 2010 Received: (at 6878) by debbugs.gnu.org; 20 Aug 2010 02:00:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmGuM-0004aZ-Gt for submit@debbugs.gnu.org; Thu, 19 Aug 2010 22:00:38 -0400 Received: from mail-gy0-f172.google.com ([209.85.160.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmGuJ-0004aU-Mq for 6878@debbugs.gnu.org; Thu, 19 Aug 2010 22:00:37 -0400 Received: by gyg8 with SMTP id 8so1061872gyg.3 for <6878@debbugs.gnu.org>; Thu, 19 Aug 2010 19:01:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.38.3 with SMTP id l3mr748685anl.197.1282269703743; Thu, 19 Aug 2010 19:01:43 -0700 (PDT) Received: by 10.100.37.18 with HTTP; Thu, 19 Aug 2010 19:01:43 -0700 (PDT) In-Reply-To: <87fwyauqwy.fsf@stupidchicken.com> References: <87r5hutw2q.fsf@stupidchicken.com> <87fwyauqwy.fsf@stupidchicken.com> Date: Thu, 19 Aug 2010 22:01:43 -0400 X-Google-Sender-Auth: Xpk40b11U389DG5vhFVcKV-ES4c Message-ID: Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element From: MON KEY To: Chong Yidong Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 6878 Cc: Juanma Barranquero , Andreas Schwab , 6878@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) On Thu, Aug 19, 2010 at 7:24 PM, Chong Yidong wrote= : > MON KEY writes: > >> The manual says a `t' or `nil' "must" be there. > > Admittedly, the wording in the manual makes it possible for a reader to > misinterpret it, if he is determined to do so. =C2=A0I have changed it to > read It isn't the determined reader its the haphazer user... > > =C2=A0 =C2=A0A @dfn{bool-vector} is a one-dimensional array whose element= s must > =C2=A0be @code{t} or @code{nil}. > > which should be less ambiguous. =C2=A0Thus, I'm closing this bug. > As you wish. Though, I don't think changing the wording solves the real pro= blem If there are no good reasons to create a boole-vectro of length 0 why allow= it? FWICG older lisp dialects from which Emacs lisp derives used bit arrays in special ways e.g. LispM Lisp `bitblt' and `boole' related functions see the= Lisp Machine Manual page 123 (of 484) and page 92 (of 484) of pdf here: (URL `http://www.bitsavers.org/pdf/mit/cadr/chinual_3rdEd_Mar81.pdf') But these systems/dialects allowed array indirction and size extension. Emacs lisp doesn't and I can think of no good reasons to create 0 length bool-vectors. Can any one else? If there are no good reasons to create a boole-vector of length 0 and nothi= ng good to do with them even when you can do it why allow it to occur in the first place? This said, its doubtfull the feature would be missed either way. Though apparently frobbing the lsb has interesting steganographic utility..= . rgrep'ing "make-boole-vector" in lisp/ finds only two active uses of `make-bool-vector' appearing in /lisp: emacs-lisp/sregex.el's `sregex--char-aux' play/mpuz.el `mpuz-found-digits' `make-bool-vector' Its use was deprecated in the following places: lisp/ChangeLog.10 2001-10-21 Miles Bader * wid-edit.el (checkbox): Swap bg/fg colors in image, and invert image bits to compensate. Use `make-string' instead of `make-bool-vector' (XBM apparently wants byte-aligned rows). revno: 40075 :from ! :off-glyph (create-image (make-bool-vector 49 1) :to ! :off-glyph (create-image (make-string 7 0) lisp/ChangeLog.9 2000-08-09 Stefan Monnier * emacs-lisp/regexp-opt.el (make-bool-vector): Remove. revno: 32042 :from ! (let* ((charwidth 256) ; Yeah, right. ! (charmap (make-bool-vector charwidth nil)) :to ! (let* ((charmap (make-char-table 'case-table)) -- /s_P\ From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 19 22:23:09 2010 Received: (at 6878) by debbugs.gnu.org; 20 Aug 2010 02:23:09 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmHG8-0004k6-P7 for submit@debbugs.gnu.org; Thu, 19 Aug 2010 22:23:08 -0400 Received: from mail-iw0-f172.google.com ([209.85.214.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmHG7-0004jo-CY for 6878@debbugs.gnu.org; Thu, 19 Aug 2010 22:23:08 -0400 Received: by iwn3 with SMTP id 3so2300783iwn.3 for <6878@debbugs.gnu.org>; Thu, 19 Aug 2010 19:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=2+d5MOCAw0iM2XfwYb7sDAT2Fkknq/YHQFofoefJVEc=; b=nfQtL0i87hBjZtCCUKaClxibEh3ll0Dn+nVxvvHOtvkTho4P06VbXQGtZePRotDeYZ ku8nG3PSDK/cQpus3ZBvXfrwZzcBJ88xbyV1umsI9AjsQVGSMBs4S6vMxdKItlr+umdm ntv69ba6ZcQ22jYF0vvJmwKn7gR8h5hJU3beM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=tJUy+qqgnBLABy0JiY4E0pr5OPrR1bW6EG+RymLt5XliT16nNnXH7sRHke2MBA9jC+ s+lF1kPKF36d3b+GLOv9D7yjOfbNieFErpORL+eyrnzS4+LTKdf18SHsNPqf0bwcDA1l xcWyn88fi0Koh+W4kGj4EaouVTEJO2vR55in4= Received: by 10.231.39.195 with SMTP id h3mr820106ibe.88.1282271052268; Thu, 19 Aug 2010 19:24:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.151.132 with HTTP; Thu, 19 Aug 2010 19:23:52 -0700 (PDT) In-Reply-To: References: <87r5hutw2q.fsf@stupidchicken.com> <87fwyauqwy.fsf@stupidchicken.com> From: Juanma Barranquero Date: Fri, 20 Aug 2010 04:23:52 +0200 Message-ID: Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element To: MON KEY Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 6878 Cc: Chong Yidong , Andreas Schwab , 6878@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) 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. (defun split-vec (v p) (list (substring v 0 p) (substring v p (length v)))) and you can do (apply 'vconcat (split-vec V N)) for N in -length(V)..length(V) and get back V =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 20 09:01:57 2010 Received: (at 6878) by debbugs.gnu.org; 20 Aug 2010 13:01:57 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmREL-0001H2-9g for submit@debbugs.gnu.org; Fri, 20 Aug 2010 09:01:57 -0400 Received: from impaqm4.telefonica.net ([213.4.138.4]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmREI-0001Gv-V8 for 6878@debbugs.gnu.org; Fri, 20 Aug 2010 09:01:55 -0400 Received: from IMPmailhost5.adm.correo ([10.20.102.126]) by IMPaqm4.telefonica.net with bizsmtp id wYH41e00F2jdgqJ3Qd2iBe; Fri, 20 Aug 2010 15:02:42 +0200 Received: from ceviche.home ([83.61.35.93]) by IMPmailhost5.adm.correo with BIZ IMP id wd2h1e00F20aCvn1ld2iAR; Fri, 20 Aug 2010 15:02:42 +0200 X-Brightmail-Tracker: AAAAAA== X-TE-authinfo: authemail="monnier$movistar.es" |auth_email="monnier@movistar.es" X-TE-AcuTerraCos: auth_cuTerraCos="cosuitnetc01" Received: by ceviche.home (Postfix, from userid 20848) id 77DD1660E9; Fri, 20 Aug 2010 15:02:41 +0200 (CEST) From: Stefan Monnier To: MON KEY Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element Message-ID: References: <87r5hutw2q.fsf@stupidchicken.com> <87fwyauqwy.fsf@stupidchicken.com> Date: Fri, 20 Aug 2010 15:02:41 +0200 In-Reply-To: (MON KEY's message of "Thu, 19 Aug 2010 22:01:43 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 6878 Cc: Juanma Barranquero , Chong Yidong , Andreas Schwab , 6878@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > As you wish. Though, I don't think changing the wording solves the > real problem If there are no good reasons to create a boole-vectro of > length 0 why allow it? That's the wrong question. The question is: why not allow them? > Emacs lisp doesn't and I can think of no good reasons to create 0 > length bool-vectors. > Can any one else? The same reasons to create zero-length strings. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 20 14:00:24 2010 Received: (at 6878) by debbugs.gnu.org; 20 Aug 2010 18:00:24 +0000 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 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 Received: by wwb22 with SMTP id 22so4476020wwb.15 for <6878@debbugs.gnu.org>; Fri, 20 Aug 2010 11:01:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.69.134 with SMTP id z6mr1507880wbi.201.1282327291871; Fri, 20 Aug 2010 11:01:31 -0700 (PDT) Received: by 10.216.65.140 with HTTP; Fri, 20 Aug 2010 11:01:31 -0700 (PDT) In-Reply-To: References: <87r5hutw2q.fsf@stupidchicken.com> <87fwyauqwy.fsf@stupidchicken.com> Date: Fri, 20 Aug 2010 14:01:31 -0400 X-Google-Sender-Auth: oea0ilEq8gi1Iu1iDax6yqtIxCs Message-ID: Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element From: MON KEY To: Juanma Barranquero Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 6878 Cc: cyd@stupidchicken.com, schwab@linux-m68k.org, 6878@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) 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\ From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 20 14:43:05 2010 Received: (at 6878) by debbugs.gnu.org; 20 Aug 2010 18:43:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmWYS-0004It-WE for submit@debbugs.gnu.org; Fri, 20 Aug 2010 14:43:05 -0400 Received: from mail-ew0-f44.google.com ([209.85.215.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmWYR-0004IW-8X for 6878@debbugs.gnu.org; Fri, 20 Aug 2010 14:43:03 -0400 Received: by ewy22 with SMTP id 22so2255001ewy.3 for <6878@debbugs.gnu.org>; Fri, 20 Aug 2010 11:44:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.145.99 with SMTP id o77mr1541445wej.113.1282329852816; Fri, 20 Aug 2010 11:44:12 -0700 (PDT) Received: by 10.216.65.140 with HTTP; Fri, 20 Aug 2010 11:44:12 -0700 (PDT) In-Reply-To: References: <87r5hutw2q.fsf@stupidchicken.com> <87fwyauqwy.fsf@stupidchicken.com> Date: Fri, 20 Aug 2010 14:44:12 -0400 X-Google-Sender-Auth: 0mqUwEvYiOMLxcbO63ED4X4Zzfg Message-ID: Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element From: MON KEY To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 6878 Cc: lekktu@gmail.com, cyd@stupidchicken.com, schwab@linux-m68k.org, 6878@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) On Fri, Aug 20, 2010 at 9:02 AM, Stefan Monnier wrote: >> As you wish. Though, I don't think changing the wording solves the >> real problem If there are no good reasons to create a boole-vectro of >> length 0 why allow it? > > That's the wrong question. The question is: why not allow them? How about Juanma's example earlier wich is a mis-application of substring on vectors satisfying the predicate `bool-vector-p' e.g. his: > (defun split-vec (v p) > (list (substring v 0 p) > (substring v p (length v)))) > >> Emacs lisp doesn't and I can think of no good reasons to create 0 >> length bool-vectors. >> Can any one else? > > The same reasons to create zero-length strings. > I'm not convinced. Anyhow, my query included the caveat "good reasons" :) (substring (make-bool-vector 0 t) 0) ;=> Debugger entered--Lisp error: (wrong-type-argument arrayp #&0"") And, it doesn't really work for vectors either: (substring (make-vector 0 1) 0) ;=> [] Likewise, where is the sense in these: (apply 'string (append (make-bool-vector 0 t) nil)) ;=> "" (concat (make-bool-vector 0 t)) ;=> "" When this: (concat) ;=> "" and this: (apply 'string nil) ;=> "" would suffice. Note, I _do_ recognize that there is some utility for things like this w/ _vanilla_ vectors: (defmacro v->empty (&optional char-val-maybe) (let ((vvoid (make-symbol "vvoid"))) `(let ((,vvoid (if (characterp ,char-val-maybe) 1 0))) (make-vector ,vvoid ,char-val-maybe)))) (v->empty 'not-a-char) ;=> [] (v->empty 32) ;=> [32] (v->empty) ;=> [] (mapconcat #'identity (mapcar #'(lambda (ve) (concat (v->empty ve))) '(119 'not-a-char 32 nil 111 'nor-inil 32 "nope" 119 'nada 33)) "") But I can't see how the `make-vector' idiom would translate for `make-bool-vector'. > Stefan > -- /s_P\ From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 20 15:48:37 2010 Received: (at 6878) by debbugs.gnu.org; 20 Aug 2010 19:48:37 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmXZs-0004pU-Pu for submit@debbugs.gnu.org; Fri, 20 Aug 2010 15:48:37 -0400 Received: from mail-iw0-f172.google.com ([209.85.214.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmXZr-0004pP-4Q for 6878@debbugs.gnu.org; Fri, 20 Aug 2010 15:48:35 -0400 Received: by iwn3 with SMTP id 3so3057784iwn.3 for <6878@debbugs.gnu.org>; Fri, 20 Aug 2010 12:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=Lg66kDky7QYWPIjtf9/n6QPYtzbzAdqAtzE4t0nv7ls=; b=sOEDw7C93CnxYRoufIsiwyPH1ELLC+PI0Xgaegb03h15oLr/PB9jyRYzfFUB7Y/NLs msLrsYX34ec5fduTtZH/iRI8gKKfvIoo0c9KCXmxvhtj4KdxbH3hBjzFwNOpMu+zED02 rkv4Yw3iwgjTKhyXXMdXMZP/Yx3+zCeXKf9JE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=AjEwqLPBtcAHz/qGpww2y/KhjE8pP7iGfvRkwiKW3xwzSim6LdzAqLe9ZzqeTscZsw vWwu7iSkDrsaCxys+tba01ovc4DYafn8g1YYGGkW1aCl5m1rMztF7cYoYHyOGELzfQx0 jqTgQ85Puf13JrJf9pL3CL9XaUN6qdC/kjdfo= Received: by 10.231.30.130 with SMTP id u2mr2113694ibc.111.1282333785269; Fri, 20 Aug 2010 12:49:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.151.132 with HTTP; Fri, 20 Aug 2010 12:49:24 -0700 (PDT) In-Reply-To: References: <87r5hutw2q.fsf@stupidchicken.com> <87fwyauqwy.fsf@stupidchicken.com> From: Juanma Barranquero Date: Fri, 20 Aug 2010 21:49:24 +0200 Message-ID: Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element To: MON KEY Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 6878 Cc: cyd@stupidchicken.com, schwab@linux-m68k.org, 6878@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On Fri, Aug 20, 2010 at 20:01, MON KEY wrote: > My question was _specifcally_ w/re to bool-vectors > one _can not_ take the substring of a bool-vector. You're right, I misread. But that's an argument, if at all, to make bool-vectors act like other vectors (which is to say, to make array/vector primitives to act on them like they do other vectors), not to make them more different. =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 20 19:05:19 2010 Received: (at 6878) by debbugs.gnu.org; 20 Aug 2010 23:05:19 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmaeE-0007Z1-EI for submit@debbugs.gnu.org; Fri, 20 Aug 2010 19:05:18 -0400 Received: from mail-ww0-f42.google.com ([74.125.82.42]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmaeB-0007Yv-Gr for 6878@debbugs.gnu.org; Fri, 20 Aug 2010 19:05:16 -0400 Received: by wwf26 with SMTP id 26so1206607wwf.3 for <6878@debbugs.gnu.org>; Fri, 20 Aug 2010 16:06:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.21.204 with SMTP id r54mr1836142wer.95.1282345585844; Fri, 20 Aug 2010 16:06:25 -0700 (PDT) Received: by 10.216.65.140 with HTTP; Fri, 20 Aug 2010 16:06:25 -0700 (PDT) In-Reply-To: References: <87r5hutw2q.fsf@stupidchicken.com> <87fwyauqwy.fsf@stupidchicken.com> Date: Fri, 20 Aug 2010 19:06:25 -0400 X-Google-Sender-Auth: 80aiKjT1OjjbeICdkLoc4v41fNU Message-ID: Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element From: MON KEY To: Juanma Barranquero Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 6878 Cc: cyd@stupidchicken.com, schwab@linux-m68k.org, 6878@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) On Fri, Aug 20, 2010 at 3:49 PM, Juanma Barranquero wrot= e: > On Fri, Aug 20, 2010 at 20:01, MON KEY wrote: >> My question was _specifcally_ w/re to bool-vectors >> one _can not_ take the substring of a bool-vector. > > You're right, I misread. > NP. So, safe to assume you haven't come up w/ a good reason to take the 0th elt of a bool-vector? > But that's an argument, if at all, to make bool-vectors act like other > vectors (which is to say, to make array/vector primitives to act on > them like they do other vectors), not to make them more different. > No. You are wrong about this. As they are currently implemented it doesn't make sense to operate directly on the bool-vector string content because the "string" is only an abstraction of the data... There isn't actually a string there to operate upon - it is miasma. More to the point you can't represent a byte as a string, and w/re bool-vec= tors the print representation of the string returned is multibyte but represents= a unibyte char! Figuring out how to reliably DTRT w/re the different ways tha= t Emacs currently conflates multibyte strings with unibyte strings would only further complicate the existing kluge that is `make-bool-vector'. What would be _much_ better would be to change the read/print syntax for `make-bool-vector' from: (make-bool-vector 29 t) ;=3D> #&29"\377\377\377=1F" to: (make-bool-vector 29 t) ;=3D> #&29[#b11111111 #b11111111 #b11111111 #b00011111] ; e.g. (/ 29 8) =3D> 3 ; (% 29 8) =3D> 5 (make-bool-vector 0 t) ;=3D> #&0[] (vconcat [#b11111111 #b11111111 #b11111111 #b00011111]) ;=3D> [255 255 255 31] (apply 'unibyte-string (append [#b11111111 #b11111111 #b11111111 #b00011111] nil)) ;=3D> "\377\377\377=1F" Something like that is quite a bit more readable to my eyes (pun intended). Though I doubt doing anything like this is very high up on anyones list given the occurences of `make-boole-vector' in ./lisp > =C2=A0 =C2=A0 Juanma > -- /s_P\ From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 21 08:39:51 2010 Received: (at submit) by debbugs.gnu.org; 21 Aug 2010 12:39:51 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmnMU-0005p7-RT for submit@debbugs.gnu.org; Sat, 21 Aug 2010 08:39:51 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmnMS-0005p2-Uf for submit@debbugs.gnu.org; Sat, 21 Aug 2010 08:39:49 -0400 Received: from lists.gnu.org ([199.232.76.165]:39052) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OmnNd-0000Az-9L for submit@debbugs.gnu.org; Sat, 21 Aug 2010 08:41:01 -0400 Received: from [140.186.70.92] (port=39421 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OmnNb-0005oo-Uh for bug-gnu-emacs@gnu.org; Sat, 21 Aug 2010 08:41:00 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OmnNZ-0003mr-VN for bug-gnu-emacs@gnu.org; Sat, 21 Aug 2010 08:40:59 -0400 Received: from lo.gmane.org ([80.91.229.12]:51584) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmnNZ-0003mg-M5 for bug-gnu-emacs@gnu.org; Sat, 21 Aug 2010 08:40:57 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OmnNW-0004WR-T8 for bug-gnu-emacs@gnu.org; Sat, 21 Aug 2010 14:40:54 +0200 Received: from c-67-166-3-76.hsd1.co.comcast.net ([67.166.3.76]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 21 Aug 2010 14:40:54 +0200 Received: from kevin.d.rodgers by c-67-166-3-76.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 21 Aug 2010 14:40:54 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Kevin Rodgers Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element Date: Sat, 21 Aug 2010 06:40:50 -0600 Lines: 19 Message-ID: References: <87r5hutw2q.fsf@stupidchicken.com> <87fwyauqwy.fsf@stupidchicken.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-67-166-3-76.hsd1.co.comcast.net User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.3 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) MON KEY wrote: > On Fri, Aug 20, 2010 at 9:02 AM, Stefan Monnier > wrote: ... >>> Emacs lisp doesn't and I can think of no good reasons to create 0 >>> length bool-vectors. >>> Can any one else? >> The same reasons to create zero-length strings. >> > > I'm not convinced. And zero-length lists, etc. Determined, indeed. -- Kevin Rodgers Denver, Colorado, USA From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 21 11:52:33 2010 Received: (at submit) by debbugs.gnu.org; 21 Aug 2010 15:52:33 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmqMy-0008Nn-SC for submit@debbugs.gnu.org; Sat, 21 Aug 2010 11:52:33 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmqMw-0008Ni-Fo for submit@debbugs.gnu.org; Sat, 21 Aug 2010 11:52:31 -0400 Received: from lists.gnu.org ([199.232.76.165]:55730) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OmqO6-0001CK-VF for submit@debbugs.gnu.org; Sat, 21 Aug 2010 11:53:43 -0400 Received: from [140.186.70.92] (port=53464 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OmqO4-00019w-Gx for bug-gnu-emacs@gnu.org; Sat, 21 Aug 2010 11:53:42 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OmqO3-0006lh-GO for bug-gnu-emacs@gnu.org; Sat, 21 Aug 2010 11:53:40 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:34528) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmqO3-0006l8-Bh for bug-gnu-emacs@gnu.org; Sat, 21 Aug 2010 11:53:39 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 6B37C1C157D6; Sat, 21 Aug 2010 17:53:36 +0200 (CEST) Received: from igel.home (ppp-93-104-151-37.dynamic.mnet-online.de [93.104.151.37]) by mail.mnet-online.de (Postfix) with ESMTP id 5FFF51C00261; Sat, 21 Aug 2010 17:53:36 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id DEA1DCA299; Sat, 21 Aug 2010 17:53:35 +0200 (CEST) From: Andreas Schwab To: Kevin Rodgers Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element References: <87r5hutw2q.fsf@stupidchicken.com> <87fwyauqwy.fsf@stupidchicken.com> X-Yow: RHAPSODY in Glue! Date: Sat, 21 Aug 2010 17:53:35 +0200 In-Reply-To: (Kevin Rodgers's message of "Sat, 21 Aug 2010 06:40:50 -0600") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.6 (----) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) Kevin Rodgers writes: > And zero-length lists, etc. There can be only one. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 21 13:01:38 2010 Received: (at 6878) by debbugs.gnu.org; 21 Aug 2010 17:01:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmrRp-0000Q0-OO for submit@debbugs.gnu.org; Sat, 21 Aug 2010 13:01:38 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmrRn-0000Pt-Hw for 6878@debbugs.gnu.org; Sat, 21 Aug 2010 13:01:36 -0400 Received: by wwb22 with SMTP id 22so5909428wwb.15 for <6878@debbugs.gnu.org>; Sat, 21 Aug 2010 10:02:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.185.211 with SMTP id u61mr709987wem.12.1282410167442; Sat, 21 Aug 2010 10:02:47 -0700 (PDT) Received: by 10.216.65.140 with HTTP; Sat, 21 Aug 2010 10:02:47 -0700 (PDT) In-Reply-To: References: Date: Sat, 21 Aug 2010 13:02:47 -0400 X-Google-Sender-Auth: g0dkeSEtOgbnS0IDHJxfQE5JK0M Message-ID: Subject: Re: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element From: MON KEY To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 6878 Cc: Juanma Barranquero , Chong Yidong , Andreas Schwab , 6878@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) On Wed, Aug 18, 2010 at 3:36 AM, Stefan Monnier wrote: >> When aref/aset'ing the 0th element of a bool-vectors of length 0 i get >> an args-out-of-range error: > > To have a 0th element, an array needs to be of length >=3D 1. > So this behavior seems perfectly correct to me. > An array of length N has elements 0..N-1, so an array of length > 0 doesn't have any elements at all. =C2=A0This should be true of strings, > vectors, and bool-vectors. > Note, a similar such issue was addressed by David Moon during the ANSI Comm= on Lisp standardization process. :SEE ftp://ftp.parc.xerox.com/pub/cl/cleanup/old-mail/bit-array-functions.m= ail.Z ,---- | Date: Tue, 23 May 89 14:42 EDT | From: David A. Moon | Subject: Issue: BIT-ARRAY-FUNCTIONS (version 5) | | Proposal (BIT-ARRAY-FUNCTIONS:ADD): | | Allow the binary bit-array functions referenced above to accept | arguments of identical rank but unequal dimensions. Nonexistent | elements of bit-array-1 or bit-array-2 are assumed to be zero. If | the third argument is T or a bit-array, result elements outside the | bounds of the array must be zero or an error should be signalled. | If the third argument is NIL or omitted, each dimension of the | result array is equal to either the corresponding dimension of | bit-array-1 or the corresponding dimension of bit-array-2. The | larger of the two dimensions is used when necessary to hold all the | nonzero elements of the result, otherwise either the larger or the | smaller of the two dimensions is used. | `---- What is interestingly relevent to this bug report #6788 w/re bool-vectsrs was Barry Margolin's initial response to Moon's proposal above: Date: Mon, 19 Jun 89 13:31 EDT From: Barry Margolin Subject: Issue: BIT-ARRAY-FUNCTIONS (version 6) ,---- | | I'd like to suggest an additional change, which seems to be | consistent with the attitude about use of bit vectors expressed in | the proposal. The BIT and SBIT functions should return 0 if asked | to access outside the bit array. This would maintain the tautology | | (bit (bit-XXX v1 v2) n) =3D=3D (logXXX (bit v1 n) (bit v2 n)) | | If slowing down these functions (they'd be the only array accessors | REQUIRED to check the dimensions) is considered unacceptable, then a | new accessor should be added. | `---- Disregarding the fact that Emacs Lisp does not have anything equivalent to the Common Lisp bit array functions it remains noteworthy that a similar issue was considered during the Common Lisp ratification and that a somewhat similar incontinuity was detected with one aspect of a proposed solution being Margolin's suggestion that: "The BIT and SBIT functions should return 0 if asked to access outside the bit array." Indeed, while I was not aware of Margolin's proposal at the time I filed the current bug report his solution bears striking resemblance to the one I provided with my initial bug report, namely: ,---- | | Maybe something like this is needed: | | (defun safe-aref-bool-vector (bool-vector idx) | (if (and (bool-vector-p bool-vector) | (not (null (append bool-vector nil)))) | (aref bool-vector idx) | 0)) | | (defun safe-aset-bool-vector (bool-vector idx) | (if (and (bool-vector-p bool-vector) | (not (null (append bool-vector nil)))) | (aset bool-vector idx) | 0)) | `---- > > =C2=A0 =C2=A0 =C2=A0 =C2=A0Stefan -- /s_P\ From unknown Mon Aug 18 09:09:03 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 19 Sep 2010 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator