From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: divoplade Newsgroups: gmane.lisp.guile.user Subject: Re: Question about data structures Date: Sun, 22 Nov 2020 22:00:33 +0100 Message-ID: <1308d70fcfbff31d9e8a655aa809016f15936419.camel@divoplade.fr> References: <3b07669d7286df2542796e309db101423bb3e147.camel@divoplade.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17222"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.34.2 To: Zelphir Kaltstahl , Guile User Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Nov 22 22:01:05 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kgwTo-0004Oy-M2 for guile-user@m.gmane-mx.org; Sun, 22 Nov 2020 22:01:04 +0100 Original-Received: from localhost ([::1]:41684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgwTn-00019K-Mc for guile-user@m.gmane-mx.org; Sun, 22 Nov 2020 16:01:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgwTV-00016b-8L for guile-user@gnu.org; Sun, 22 Nov 2020 16:00:46 -0500 Original-Received: from relay11.mail.gandi.net ([217.70.178.231]:49337) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgwTO-0007fO-3T for guile-user@gnu.org; Sun, 22 Nov 2020 16:00:45 -0500 Original-Received: from divoplade.home (lfbn-poi-1-813-104.w86-254.abo.wanadoo.fr [86.254.138.104]) (Authenticated sender: d@divoplade.fr) by relay11.mail.gandi.net (Postfix) with ESMTPSA id C2570100005; Sun, 22 Nov 2020 21:00:34 +0000 (UTC) In-Reply-To: Received-SPF: pass client-ip=217.70.178.231; envelope-from=d@divoplade.fr; helo=relay11.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17039 Archived-At: Le dimanche 22 novembre 2020 à 21:24 +0100, Zelphir Kaltstahl a écrit : > If I had a vector, I could simply go by index backwards or > forwards without adding any runtime complexity. So, you would like to sometimes go forward, sometimes go backward? If it is sequential, the list is what you want. With the 2-variable function used earlier, you can go in one direction or the other, depending on which argument you decompose. > a more specific > but less generally useful question is: "What do I use in Guile, if I > were using a dynamic array in Python?" It depends. If you were using a dynamic array in Python because there was no good implementation of what guile calls lists or vectors, use lists or vectors ;-) If you were using a dynamic array because you wanted to grow lists while keeping random indexing, use VLists ( https://www.gnu.org/software/guile/manual/guile.html#VLists). Or hash tables (https://www.gnu.org/software/guile/manual/guile.html#VHashes, https://www.gnu.org/software/guile/manual/guile.html#Hash-Tables).