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 20:45:05 +0100 Message-ID: <3b07669d7286df2542796e309db101423bb3e147.camel@divoplade.fr> References: 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="20583"; 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 20:45:42 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 1kgvIr-0005Fn-VC for guile-user@m.gmane-mx.org; Sun, 22 Nov 2020 20:45:41 +0100 Original-Received: from localhost ([::1]:50854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgvIq-0001nZ-Tb for guile-user@m.gmane-mx.org; Sun, 22 Nov 2020 14:45:40 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgvIR-0001n9-8G for guile-user@gnu.org; Sun, 22 Nov 2020 14:45:15 -0500 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:36755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgvIO-0004kS-S9 for guile-user@gnu.org; Sun, 22 Nov 2020 14:45:15 -0500 X-Originating-IP: 86.254.138.104 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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 9081E1C0004; Sun, 22 Nov 2020 19:45:07 +0000 (UTC) In-Reply-To: Received-SPF: pass client-ip=217.70.183.197; envelope-from=d@divoplade.fr; helo=relay5-d.mail.gandi.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, 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:17036 Archived-At: Hello Zelphir! Le dimanche 22 novembre 2020 à 19:48 +0100, Zelphir Kaltstahl a écrit : > However, when I use the list in > reverse and ever need to output the lines in the list in their > original > order, I would first need to `reverse` the list again. There is a "reverse" function; you could implement it yourself as a tail-recursive function if you wanted (it's currently implemented in C, so my guess is it's even more efficient). You don't need vectors for that. (define (my-reverse-aux accumulation list) (if (null? list) accumulation (my-reverse-aux (cons (car list) accumulation) (cdr list)))) (define (my-reverse list) (my-reverse-aux '() list)) (my-reverse '(a b c d e f g h))