In trying to explore this library
https://gitlab.com/dustyweb/guile-csexps/
I neede to write a small file in Guile scheme
The library offers a function that takes, among other things, a port to write its output onto
Now in the #guile manual there are at least 3 locations that carrry relevant bits
1)
Guile modules -> POSIX -> Ports and file descriptors
2)
API referrence -> Input and Output -> Port types -> File ports
3)
API reference -> Input and Output -> Buffering
The third one carries a bit about ""call-with-output-file"
You're supposed to call it like this
(call-with-output-file "some-file.txt"
(lambda (port)
(write-something-on-port port)))
In this case the port will be closed AUTOMATICALLY after its use, so you'll find the expected results in the file
These 3 locations are deeply nested in the chapters structure and are not even in linear order.
You have to jump form one to the other
Writing a file is probably the most basic use case
I think this tal is pertinent:
https://archive.fosdem.org/2017/schedule/event/legacy_docs/
an excerpt: "It has become cumbersome to wade through chapters upon chapters of docs, looking for the relevant bits, ... We need topic-based, action-oriented content to guide users through specific tasks. So, how do we turn the voluminous guides of yesterday into lean, modularized narratives that are easy to maintain, scale well, and still allow for a ‘guide-like’ experience when it is required?"
this picture is taken from the slides
So this is probably material for a blog post
@catonano ah! These are in R6RS standard scheme. My guess is that you’re expected to know this...which is silly.
@apg absolutely 😐
@apg but please read the thrread until the end ! 😀
the second one carries bits about "open-output-file"
You're supposed to call it like this
(open-output-file "some-file.txt")
it returns a port, let's call it $1
(write-something-on-port $1)
(close-port $1)
Pay attention: if you don't close the port it's possible that the file will be created but nothing will be written in it