Hi all!
Thank you for your plentiful replies, I did not forget you. I simply did
not get around to to answering everyone. I got something out of it. I
still need to apply it in my program and will probably discover more
things to it, like always.
Best wishes,
Zelphir
--
repositories:
On Sun, Nov 22, 2020 at 10:43 PM Taylan Kammer wrote:
>
> Python lists, JDK's ArrayList, and .NET ArrayList, among probably many
> other "list" or "array" data structures in popular languages nowadays
> use a relatively straightforward data structure that is backed by an
> actual array which can
Zelphir Kaltstahl writes:
> How do you approach this problem? Is it a problem at all?
I would use a deque: a double ended queue. Cheap push and pop at end and
beginning.
https://srfi.schemers.org/srfi-134/srfi-134.html
I created a guile-implementation for that:
On Sun, 22 Nov 2020 at 18:49, Zelphir Kaltstahl
wrote:
> Hello Guile Users!
>
> I have a question about data structures.
>
> Recently I read a file and the lines in the file would become a list in
> my Guile program. The file was not super big or anything. However, I
> usually try to avoid
On Sun, Nov 22, 2020 at 10:43 PM Taylan Kammer
wrote:
Since your main concern seems to be appending, you could simply use a
> linked list where you keep a reference to the last cons pair (tail) of
> the list, so appending is simply a matter of a 'set-cdr!' operation on
> the tail.
>
SRFI 117,
On 22.11.2020 19:48, Zelphir Kaltstahl wrote:
Hello Guile Users!
I have a question about data structures.
[...]
How do you approach this problem? Is it a problem at all?
First of all, be cautious about premature optimization. In many cases
it's best to just write the code the most
On Sunday, 22 November 2020 19:48:24 CET Zelphir Kaltstahl wrote:
> Hello Guile Users!
>
> I have a question about data structures.
>
> Recently I read a file and the lines in the file would become a list in
> my Guile program. The file was not super big or anything. However, I
> usually try to
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.
divoplade writes:
> 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
Hi divoplade!
I know there is reverse and I think I did implement it before, when
working through SICP exercises. Thanks for that implementation and input
though!
I think the point I wanted to make is rather to avoid `reverse`
completely. If I had a vector, I could simply go by index backwards
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
11 matches
Mail list logo