* Trouble trying to use some modules from the docs
@ 2018-06-02 17:13 Zelphir Kaltstahl
2018-06-02 17:21 ` Matt Wette
0 siblings, 1 reply; 3+ messages in thread
From: Zelphir Kaltstahl @ 2018-06-02 17:13 UTC (permalink / raw)
To: guile-user
Hello Guile mailing list members,
Guile Scheme beginner here.
I want to play with network programming things in Guile a little, but I
cannot figure out how to use the modules, which are described in the
docs at
https://www.gnu.org/software/guile/manual/html_node/Network-Sockets-and-Communication.html
.
There is no (use-modules ...) example anywhere I looked and I could also
not find any examples in search engines. For other modules I somehow
always found an example (use-modules ...) somewhere, mostly in the docs.
Is there some inherent way of simply knowing how to import a module? I
did not read all of the docs from front to back, but that really should
not be necessary in order to use some part of it.
What I've tried already:
(use-modules (ice-9 posix)) ; maybe the same way many other things are
imported?
(use-modules (posix)) ; maybe it's its own module?
(use-modules (std posix)) ; maybe "std" for "standard" works?
None of those worked in the REPL.
A search on Github:
https://github.com/cky/guile/search?utf8=%E2%9C%93&q=use-modules+posix&type=
Yielded the following interesting result:
https://github.com/cky/guile/blob/c1eb929258fc6b9653d31c0d1bc654d9e300d4e5/module/ice-9/boot-9.scm#L1445
But why does (use-modules (ice-9 posix)) not work then? I am out of ideas.
Can you point me to the part of the docs, which explain how to always
know how to import a module, if there is such? Or, if there is no such
thing, can you help me out in this case?
Regards,
Zelphir
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Trouble trying to use some modules from the docs
2018-06-02 17:13 Zelphir Kaltstahl
@ 2018-06-02 17:21 ` Matt Wette
0 siblings, 0 replies; 3+ messages in thread
From: Matt Wette @ 2018-06-02 17:21 UTC (permalink / raw)
To: guile-user
On 06/02/2018 10:13 AM, Zelphir Kaltstahl wrote:
> Hello Guile mailing list members,
>
> Guile Scheme beginner here.
>
> I want to play with network programming things in Guile a little, but I
> cannot figure out how to use the modules, which are described in the
> docs at
> https://www.gnu.org/software/guile/manual/html_node/Network-Sockets-and-Communication.html
> .
>
> There is no (use-modules ...) example anywhere I looked and I could also
> not find any examples in search engines. For other modules I somehow
> always found an example (use-modules ...) somewhere, mostly in the docs.
>
> Is there some inherent way of simply knowing how to import a module? I
> did not read all of the docs from front to back, but that really should
> not be necessary in order to use some part of it.
>
> What I've tried already:
>
> (use-modules (ice-9 posix)) ; maybe the same way many other things are
> imported?
> (use-modules (posix)) ; maybe it's its own module?
> (use-modules (std posix)) ; maybe "std" for "standard" works?
>
> None of those worked in the REPL.
>
> A search on Github:
>
> https://github.com/cky/guile/search?utf8=%E2%9C%93&q=use-modules+posix&type=
>
> Yielded the following interesting result:
>
> https://github.com/cky/guile/blob/c1eb929258fc6b9653d31c0d1bc654d9e300d4e5/module/ice-9/boot-9.scm#L1445
>
> But why does (use-modules (ice-9 posix)) not work then? I am out of ideas.
>
> Can you point me to the part of the docs, which explain how to always
> know how to import a module, if there is such? Or, if there is no such
> thing, can you help me out in this case?
>
> Regards,
>
> Zelphir
>
The manual is not crystal clear in all uses of procedures. The posix procedures are built-in so
no `(use-module ...)' is necessary. The test is to just type the procedure name. You will get a
procedure object in return. see example below. (Note this does not work with syntax.)
mwette$ guile
GNU Guile 2.2.3
Copyright (C) 1995-2017 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> getaddrinfo
$1 = #<procedure getaddrinfo (_ #:optional _ _ _ _ _)>
scheme@(guile-user)>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Trouble trying to use some modules from the docs
[not found] <mailman.95.1529164820.9281.guile-user@gnu.org>
@ 2018-06-16 18:41 ` Zelphir Kaltstahl
0 siblings, 0 replies; 3+ messages in thread
From: Zelphir Kaltstahl @ 2018-06-16 18:41 UTC (permalink / raw)
To: guile-user
On 16.06.2018 18:00, guile-user-request@gnu.org wrote:
> Message: 3
> Date: Sat, 16 Jun 2018 06:36:46 -0700
> From: Matt Wette <matt.wette@gmail.com>
> To: guile-user@gnu.org
> Subject: Re: Trouble trying to use some modules from the docs (Matt
> Wette)
> Message-ID: <a43f73f7-d3d6-03a8-1d42-d79200249463@gmail.com>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
>
> On 06/16/2018 02:35 AM, Zelphir Kaltstahl wrote:
>> Hello,
>>
>> I have managed to get another case of a binding not being available
>> according to the Guile REPL, this time I have the code and way to
>> reproduce the issue.
>> ;; ===== HELPERS MODULE (networking-lib/helpers.scm) =====
>> (use-modules (rnrs bytevectors))
>>
>> (define-module (networking-lib helpers)
>> ? #:export (display-byte-vector))
>>
> With above code, bytevector import is NOT in the context of your
> module.? Try
>
> (define-module (networking-lib helpers)
> ? #:export (display-byte-vector))
>
> (use-modules (rnrs bytevectors))
>
>
> OR
>
>
> (define-module (networking-lib helpers)
> ? #:export (display-byte-vector)
> ? #:use-module (rnrs bytevectors))
Thank you Matt, that worked.
Somehow I assumed, that it would "magically" make the used modules also
available in the code, which uses the helpers module.
Now I can have less/no code duplication : )
I have now changed the code and I have it here:
https://gitlab.com/zelphir-kaltstahl-projects/guile-scheme-tutorials-and-examples/tree/dev/network-programming
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-16 18:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.95.1529164820.9281.guile-user@gnu.org>
2018-06-16 18:41 ` Trouble trying to use some modules from the docs Zelphir Kaltstahl
2018-06-02 17:13 Zelphir Kaltstahl
2018-06-02 17:21 ` Matt Wette
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).