From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Hartwig Newsgroups: gmane.lisp.guile.devel Subject: Re: vectors are something else Date: Fri, 12 Apr 2013 07:53:02 +0800 Message-ID: References: <26E44D8E-2A75-466E-BFAE-07E15F60A981@bluewin.ch> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1365724388 26137 80.91.229.3 (11 Apr 2013 23:53:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Apr 2013 23:53:08 +0000 (UTC) Cc: guile-devel To: Daniel Llorens Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Apr 12 01:53:12 2013 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UQRIj-0007Le-7H for guile-devel@m.gmane.org; Fri, 12 Apr 2013 01:53:09 +0200 Original-Received: from localhost ([::1]:48642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQRIi-0001Xp-U4 for guile-devel@m.gmane.org; Thu, 11 Apr 2013 19:53:08 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQRIf-0001UU-1i for guile-devel@gnu.org; Thu, 11 Apr 2013 19:53:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQRIe-00022Q-1e for guile-devel@gnu.org; Thu, 11 Apr 2013 19:53:04 -0400 Original-Received: from mail-ie0-x236.google.com ([2607:f8b0:4001:c03::236]:64995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQRId-00022F-U5 for guile-devel@gnu.org; Thu, 11 Apr 2013 19:53:03 -0400 Original-Received: by mail-ie0-f182.google.com with SMTP id at1so2779387iec.27 for ; Thu, 11 Apr 2013 16:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=bFL5PHV9jpW3VhRCCjkBdHnVItuDp/YeqwWlpEkOrTI=; b=Kgk3o8l/+iQuQ5xlypWkyDq2lClZ0tRzzEbbkFuRZXF8gTcLylw1l5wb7vgQ4XqG1o tErZ3vkhsEtXol84mbA7oGco8L3pA50FdjuqG+GX3XIVmkE+/YDA9886oTKwKWBa7uGi edt3SjOqPo7r/lftS1DBWmMorc3zfbg+Veg8/m+HEQteO29tBJdiS4sXLUYyDBnx9Bw8 LERJZI70vO/7tlq4wgY9IkW5J5y1kapznNNm0Fna8VsgRMcmeEDEKiu1lvExhT9kznd7 qTyCmjijrc31ivKSi4TLft/J6ZQXL2G111ssuAXDToxSp3d5yAm5h4i0q38Bj/fPlIkn PPxA== X-Received: by 10.50.134.4 with SMTP id pg4mr151795igb.96.1365724383035; Thu, 11 Apr 2013 16:53:03 -0700 (PDT) Original-Received: by 10.64.26.168 with HTTP; Thu, 11 Apr 2013 16:53:02 -0700 (PDT) In-Reply-To: <26E44D8E-2A75-466E-BFAE-07E15F60A981@bluewin.ch> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c03::236 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16220 Archived-At: On 11 April 2013 07:07, Daniel Llorens wrote: > > After the array-map patches, I've gone through the vector/array implementation and there's some stuff I'd like to fix. In stable-2.0 today: > > (define a (make-typed-array ''f64 0 '(1 2)) > a > => #1f64@1(0.0 0.0) > > so far so good. > > (uniform-vector? a) > => #t > > (f64vector-ref? a) > => #t > > so far so good. > > (uniform-vector-ref a 0) > => 0.0 > > This is a bug, since the valid indices are 1 and 2. This bug is in scm_c_generalized_vector_ref (and elsewhere): For a vector, the valid indices are as specified by r5rs: The _valid indexes_ of a vector are the exact non-negative integers less than the length of the vector. The first element in a vector is indexed by zero, and the last element is indexed by one less than the length of the vector. which applies even when accessing arrays as vectors. Offset indexing is a feature of the array interface only.