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 21:04:36 +0800 Message-ID: References: <87hauku0mb.fsf@fencepost.gnu.org> <87fwa2dxmh.fsf@pobox.com> <87mx4aqijf.fsf@fencepost.gnu.org> <87zk8accoq.fsf@pobox.com> <87ehpmqcs7.fsf@fencepost.gnu.org> <87aa0aqc6y.fsf@fencepost.gnu.org> <8762ayqbus.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1339420771 17798 80.91.229.3 (11 Jun 2012 13:19:31 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 11 Jun 2012 13:19:31 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Jun 11 15:19:30 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 1Se4Wl-00067n-7s for guile-devel@m.gmane.org; Mon, 11 Jun 2012 15:19:27 +0200 Original-Received: from localhost ([::1]:54276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Se4Id-0007Gs-1h for guile-devel@m.gmane.org; Mon, 11 Jun 2012 09:04:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Se4IW-00075t-Bm for guile-devel@gnu.org; Mon, 11 Jun 2012 09:04:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Se4IR-0004PT-GP for guile-devel@gnu.org; Mon, 11 Jun 2012 09:04:43 -0400 Original-Received: from mail-gh0-f169.google.com ([209.85.160.169]:44129) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Se4IR-0004Ow-9i for guile-devel@gnu.org; Mon, 11 Jun 2012 09:04:39 -0400 Original-Received: by ghrr18 with SMTP id r18so2894130ghr.0 for ; Mon, 11 Jun 2012 06:04:37 -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:content-transfer-encoding; bh=CMOdT2lfxvcC945yki+7OcwXMWO3RXILq0euFKNgZLI=; b=j6TYQdDuPPgJh2rADHtORPeUAgObWdJ/Gi9Gf94fy09hCpaBqux5xaOt2ENjdB2n6V 6lY9NBrAC6ehZLMh1WkCtPfkwfUyVpseVubVms23pnLAMUkUxp0u8JIDu8XndHElIeKx bUwCVD2Mj8iH+Jv6mHi1shzrbnj5P0lyOvaYM9ZNg5UwnnovY8lMXCqn4l9A0WAvRYSi kKVbGiDfTV+rg5ErfwcdJLFCtnfNb9HsTkNdwW0lee1DRxLRt8WdzomnSrIqpIqYwVel pWKr75hPr60jVSkQYvJiEGsB28gcGADQ9tw3IxMGiq75Q9Ujo3/4MYGTO240oBu7vm8Z 95yg== Original-Received: by 10.50.219.136 with SMTP id po8mr6017000igc.70.1339419877314; Mon, 11 Jun 2012 06:04:37 -0700 (PDT) Original-Received: by 10.231.206.198 with HTTP; Mon, 11 Jun 2012 06:04:36 -0700 (PDT) In-Reply-To: <8762ayqbus.fsf@fencepost.gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.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:14599 Archived-At: On 11 June 2012 20:20, David Kastrup wrote: >> P.S.: I still need to look at vlists. =C2=A0They might already address t= his >> =C2=A0 =C2=A0 =C2=A0 issue, though I can't use them in Guile 1.8. > > No, the "immutable" angle would make them unsuitable again. Note that vlists are only immutable in the sense that you can not modify the value of a slot already allocated. You can modify the object that a slot points to and you can extend a vlist as much as you like. Multiple vlists can even share tails. For example, this session modifies the object in slot 0 of the vlist: > (use-modules (ice-9 vlist)) > (list->vlist '((a b) (c d) (e f))) $1 =3D # > (vlist-ref $1 0) $2 =3D (a b) > (set-cdr! $2 '(boo)) > $1 $3 =3D # > Scheme/Guile vectors are fixed size. Now I have a situation where I > have a basic type lattice with records stored in vectors, and this type > lattice may be extended dynamically (which typically happens at the > start of a whole file, for potentially multi-file runs). >From this I gather that your use case only appends to the lattice, if so, vlist is suitable for that task. > Cough, cough. Standard vectors are not growable. Which is the original > problem of this thread, never mind Lua. True, but a growable vector is a tiny step away from the standard vector. > hashtables have additional indirection > through hash buckets and coalescing lists This is fairly standard for a hash table. I would be quite surprised if the hash table part of a Lua table did not also use buckets. > Except that this one isn't. Why not? You take a vector and a hash table, store your values in them, and grow either as needed. This is not a complicated type.