unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Zelphir Kaltstahl <zelphirkaltstahl@gmail.com>
To: guile-user@gnu.org
Subject: Re: Trouble trying to use some modules from the docs (Matt Wette)
Date: Mon, 4 Jun 2018 18:35:04 +0200	[thread overview]
Message-ID: <166833aa-51f8-d00e-62e2-b5d7282354cc@gmail.com> (raw)
In-Reply-To: <mailman.103.1528041619.20010.guile-user@gnu.org>


On 03.06.2018 18:00, guile-user-request@gnu.org wrote:
> 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)>

Thank you!

Something must be up with either the Guile REPL or the Guile REPL inside
Emacs' M-x shell. I tried to run socket in it and it could not find
that. I also ran other code before that, so maybe the issue was, that
that somehow prevented the REPL from finding the bindings. However, now
that I tried what you wrote in a completely new REPL in a XFCE terminal,
it works flawlessly. And such a thing has happened to me before with
another module inside Emacs M-x shell mode.
I think what I can take from this is, that if there is no use-modules
part in the docs, it is likely available without running such and if it
is not available I should check outside of Emacs in a standard terminal
emulator.


       reply	other threads:[~2018-06-04 16:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.103.1528041619.20010.guile-user@gnu.org>
2018-06-04 16:35 ` Zelphir Kaltstahl [this message]
2018-06-05 19:36   ` Trouble trying to use some modules from the docs (Matt Wette) Mark H Weaver
2018-06-16  9:35 ` Zelphir Kaltstahl
2018-06-16 13:36   ` Matt Wette

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=166833aa-51f8-d00e-62e2-b5d7282354cc@gmail.com \
    --to=zelphirkaltstahl@gmail.com \
    --cc=guile-user@gnu.org \
    /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).