From: divoplade <d@divoplade.fr>
To: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>,
Guile User <guile-user@gnu.org>
Subject: Re: Question about data structures
Date: Sun, 22 Nov 2020 20:45:05 +0100 [thread overview]
Message-ID: <3b07669d7286df2542796e309db101423bb3e147.camel@divoplade.fr> (raw)
In-Reply-To: <d8df761e-0f1f-d57d-1180-ab23c928ee82@posteo.de>
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))
next prev parent reply other threads:[~2020-11-22 19:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-22 18:48 Question about data structures Zelphir Kaltstahl
2020-11-22 19:45 ` divoplade [this message]
2020-11-22 20:24 ` Zelphir Kaltstahl
2020-11-22 21:00 ` divoplade
2020-11-28 2:47 ` Zelphir Kaltstahl
2020-11-22 20:58 ` kwright
2020-11-22 22:50 ` Tim Van den Langenbergh
2020-11-23 3:42 ` Taylan Kammer
2020-11-23 4:42 ` John Cowan
2020-11-23 14:54 ` [EXT] " Thompson, David
2020-11-23 9:52 ` Neil Jerram
2020-11-23 12:24 ` Dr. Arne Babenhauserheide
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3b07669d7286df2542796e309db101423bb3e147.camel@divoplade.fr \
--to=d@divoplade.fr \
--cc=guile-user@gnu.org \
--cc=zelphirkaltstahl@posteo.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).