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: Growable arrays? Date: Mon, 11 Jun 2012 17:13:00 +0800 Message-ID: References: <87hauku0mb.fsf@fencepost.gnu.org> <873962sbu0.fsf@fencepost.gnu.org> <87y5nuqpii.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=e89a8f2357cdb0a79804c22ec1c0 X-Trace: dough.gmane.org 1339405995 7643 80.91.229.3 (11 Jun 2012 09:13:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 11 Jun 2012 09:13:15 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Jun 11 11:13:15 2012 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 1Se0gR-0001nI-NE for guile-devel@m.gmane.org; Mon, 11 Jun 2012 11:13:11 +0200 Original-Received: from localhost ([::1]:53588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Se0gR-0001qw-AT for guile-devel@m.gmane.org; Mon, 11 Jun 2012 05:13:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Se0gO-0001qN-Vj for guile-devel@gnu.org; Mon, 11 Jun 2012 05:13:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Se0gI-0006tX-SA for guile-devel@gnu.org; Mon, 11 Jun 2012 05:13:08 -0400 Original-Received: from mail-gg0-f169.google.com ([209.85.161.169]:48759) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Se0gI-0006t3-Ly for guile-devel@gnu.org; Mon, 11 Jun 2012 05:13:02 -0400 Original-Received: by ggm4 with SMTP id 4so2726879ggm.0 for ; Mon, 11 Jun 2012 02:13:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=9Tj1ddx9jbqnAzXSblapTOIu4n6PEeQkMjTyplIZryE=; b=i2tKAwjO7yWxqDCHV1frdCyhFIMh8cgWBSuGqRFi/84ZHz6NuQdQGD9pIyPliMh/HH c+2NpJc4iRmzbZlgJGeppzyUycbqMcgvE51jHRtivCd4ZtU2HSUDqow//rcVLvJUKrOr nwYGLmrMIU9fj+4XqjFYkX+3CXvLF7uguh2/Zy+IlA8/NPBMYkNhJeQWMy1NKTnUXaFd ABnHK6Hy1hcE4/XJG9xnjQZDLI9mDy5WzPEXAYnZNO7I3vv78awjs1Ttf9AYzlM5Wv1j bZo4zi/tUCuLC0pCJKY9R0XEFq0XCiaVcRYulqizz/4/1V+7+ASFsZVl01nGGfqlNtJv s1/Q== Original-Received: by 10.50.104.167 with SMTP id gf7mr5828266igb.38.1339405980706; Mon, 11 Jun 2012 02:13:00 -0700 (PDT) Original-Received: by 10.231.206.198 with HTTP; Mon, 11 Jun 2012 02:13:00 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.161.169 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:14582 Archived-At: --e89a8f2357cdb0a79804c22ec1c0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 11 June 2012 17:01, Daniel Hartwig wrote: > For reference, attached is a growable vector I use in several > projects, adapted to support the length operation similar to Lua (i.e. > first unset numerical index). =C2=A0There is no catching of exceptions > here, every access to the data is through the dynvector procedures > which check the index and vector size. Always test before posting even small changes to existing code :-) Updated attachment to actually run without problems --e89a8f2357cdb0a79804c22ec1c0 Content-Type: application/octet-stream; name="dynvector.scm" Content-Disposition: attachment; filename="dynvector.scm" Content-Transfer-Encoding: base64 X-Attachment-Id: f_h3bbq7p71 KGRlZmluZS1tb2R1bGUgKGR5bnZlY3RvcikKICAjOnVzZS1tb2R1bGUgKHNyZmkgc3JmaS05KQog ICM6ZXhwb3J0IChkeW52ZWN0b3IKICAgICAgICAgICAgbWFrZS1keW52ZWN0b3IKICAgICAgICAg ICAgZHludmVjdG9yPwogICAgICAgICAgICBkeW52ZWN0b3ItbGVuZ3RoCiAgICAgICAgICAgIGR5 bnZlY3Rvci1jYXBhY2l0eQogICAgICAgICAgICBkeW52ZWN0b3ItcmVmCiAgICAgICAgICAgIGR5 bnZlY3Rvci1zZXQhCiAgICAgICAgICAgIGR5bnZlY3Rvci1ncm93dGgtZmFjdG9yKSkKCihkZWZp bmUtcmVjb3JkLXR5cGUgZHludmVjdG9yLXR5cGUKICAoJW1ha2UtZHludmVjdG9yIGRhdGEgY2Fj aGVkLWxlbmd0aCkKICBkeW52ZWN0b3I/CiAgKGRhdGEgZHludmVjdG9yLWRhdGEgc2V0LWR5bnZl Y3Rvci1kYXRhISkKICAoY2FjaGVkLWxlbmd0aCBkeW52ZWN0b3ItY2FjaGVkLWxlbmd0aCBzZXQt ZHludmVjdG9yLWNhY2hlZC1sZW5ndGghKSkKCihkZWZpbmUgZHludmVjdG9yLWdyb3d0aC1mYWN0 b3IKICAobWFrZS1mbHVpZCAyKSkKCihkZWZpbmUgKGR5bnZlY3RvciAuIGwpCiAgKCVtYWtlLWR5 bnZlY3RvciAoYXBwbHkgdmVjdG9yIGwpICNmKSkKCihkZWZpbmUgKG1ha2UtZHludmVjdG9yIGxl biAuIHJlc3QpCiAgKCVtYWt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