Re: getting to know the FFI ...

2020-11-22 Thread Matt Wette
On 11/19/20 7:02 PM, Tim Meehan wrote: I figured that I would try and do something simple-ish to see how well I understood the FFI. I found this GTK tutorial, written in Chez Scheme: https://github.com/jhidding/lyonesse/blob/master/gtk-tutorial/window.scm I just tried to replace the Chez FFI c

Question about data structures

2020-11-22 Thread Zelphir Kaltstahl
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 having to use `append` or `reverse`, whenever possible, considering, that t

Re: eof-object? documentation

2020-11-22 Thread Zelphir Kaltstahl
On 21.11.20 09:52, randomlooser wrote: > Il giorno dom, 15/11/2020 alle 13.16 +0100, Zelphir Kaltstahl ha > scritto: >> Nevermind … One line below the definition in the docs it says: >> >> "Note that unlike other procedures in this module, eof-object? is >> defined in the default environment. " >>

Re: Question about data structures

2020-11-22 Thread divoplade
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 imp

Re: Question about data structures

2020-11-22 Thread Zelphir Kaltstahl
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 or

Re: Question about data structures

2020-11-22 Thread kwright
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 "rev

Re: Question about data structures

2020-11-22 Thread divoplade
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.

Re: eof-object? documentation

2020-11-22 Thread Adriano Peluso
Il giorno dom, 22/11/2020 alle 19.57 +0100, Zelphir Kaltstahl ha scritto: > I did not find the repository of the Guile reference manual yet. Can > anyone point me to it? Then I could perhaps add examples, notes or  > remove  the "?" from the page and that phrase other stuff via pull > request. >

Guile dynamic FFI, C function expecting pointer

2020-11-22 Thread Tim Meehan
I tried to boil this question down to the most simple thing that represented what I needed to understand. I have had luck getting C functions that expect arguments "by value," but "by reference" has been problematic. The failure mode is "Segmentation Fault," so I gather that I may not be using the

Re: Question about data structures

2020-11-22 Thread Tim Van den Langenbergh
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 avo

broken link on "Learn" page

2020-11-22 Thread Tim Meehan
There is a broken link to the "Internet Scheme Repository" on the "Learn" page of the GNU Guile website: https://www.gnu.org/software/guile/learn/ I didn't see a contact email on the website, but I figured that someone here might know someone that ran the website ... if not, my apologies.

Re: Guile dynamic FFI, C function expecting pointer

2020-11-22 Thread Matt Wette
On 11/22/20 2:50 PM, Tim Meehan wrote: I tried to boil this question down to the most simple thing that represented what I needed to understand. I have had luck getting C functions that expect arguments "by value," but "by reference" has been problematic. The failure mode is "Segmentation Fau

Re: Question about data structures

2020-11-22 Thread Taylan Kammer
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 straight

Re: Question about data structures

2020-11-22 Thread John Cowan
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, Li