From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.bugs Subject: Re: make-shared-array and bitvectors Date: Fri, 17 Nov 2006 14:58:27 +0000 Message-ID: <87odr6qfvw.fsf@ossau.uklinux.net> References: <4548CF2B020000FC0000425F@WC-MESSAGE.westminster.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1163775962 25284 80.91.229.2 (17 Nov 2006 15:06:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 17 Nov 2006 15:06:02 +0000 (UTC) Cc: bug-guile@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Nov 17 16:06:00 2006 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Gl5Hl-0007fe-C2 for guile-bugs@m.gmane.org; Fri, 17 Nov 2006 16:05:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gl5Hk-0004ba-Tt for guile-bugs@m.gmane.org; Fri, 17 Nov 2006 10:05:44 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gl5HX-0004VI-DV for bug-guile@gnu.org; Fri, 17 Nov 2006 10:05:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gl5HV-0004U0-Tq for bug-guile@gnu.org; Fri, 17 Nov 2006 10:05:30 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gl5HV-0004TX-K7 for bug-guile@gnu.org; Fri, 17 Nov 2006 10:05:29 -0500 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Gl5HV-0003Ek-57 for bug-guile@gnu.org; Fri, 17 Nov 2006 10:05:29 -0500 Original-Received: from laruns (host86-145-51-69.range86-145.btcentralplus.com [86.145.51.69]) by mail3.uklinux.net (Postfix) with ESMTP id E80C140A639; Fri, 17 Nov 2006 14:59:07 +0000 (UTC) Original-Received: from laruns (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id B8E006FEA7; Fri, 17 Nov 2006 14:58:27 +0000 (GMT) Original-To: "Ryan Moore" In-Reply-To: <4548CF2B020000FC0000425F@WC-MESSAGE.westminster.edu> (Ryan Moore's message of "Wed, 01 Nov 2006 16:45:31 -0500") User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:3385 Archived-At: "Ryan Moore" writes: > Making a shared array out of a bit vector does not result in a bit > vector being returned when the shared array does not have as many > elements as the original: > > (define somebits (make-bitvector 8 #f)) > (define subbits (make-shared-array somebits (lambda (dim) (list dim)) > 4)) > (define allsubbits (make-shared-array somebits (lambda (dim) (list dim)) > 8)) > > (bitvector? somebits) => #t > (bitvector? subbits) => #f > (bitvector? allsubbits) => #t And in fact: (eq? somebits allsubbits) => #t Because of this special case code in scm_make_shared_array: if (1 == SCM_I_ARRAY_NDIM (ra) && 0 == SCM_I_ARRAY_BASE (ra)) { SCM v = SCM_I_ARRAY_V (ra); size_t length = scm_c_generalized_vector_length (v); if (1 == s->inc && 0 == s->lbnd && length == 1 + s->ubnd) return v; ... } So allsubbits is really just another reference to somebits, not a shared array at all. > The 1.8 manual states: "Bit vectors are are also generalized vectors, > See Generalized Vectors, and can thus be used with the array procedures, > See Arrays" but as we can see, array procedures do not work as expected > on bitvectors. If this is expected behavior, I feel it should be > clarified. I would think that making a shared array out of a bitvector > would result in a bitvector after all... According to the current implementation, it's wrong (in general) to expect (make-shared-array ...) to satisfy the bitvector? predicate. Is this a problem for you in practice? Regards, Neil _______________________________________________ Bug-guile mailing list Bug-guile@gnu.org http://lists.gnu.org/mailman/listinfo/bug-guile