From: John Cowan <cowan@ccil.org>
To: Rohan Drape <rohan.drape@gmail.com>
Cc: guile-user <guile-user@gnu.org>
Subject: Re: r6rs and posix sockets
Date: Sat, 23 Jan 2021 00:10:51 -0500 [thread overview]
Message-ID: <CAD2gp_QgC2e-7YqE0wFgxCO9Z6gVfD4eALcZS59MNN0H3H4djg@mail.gmail.com> (raw)
In-Reply-To: <CAHnM+yYPd2pOjigvhPYVA_=7_=1t=LnuqGHFVwGEz0WkhfgeFA@mail.gmail.com>
(import (guile)) does the trick.
On Fri, Jan 22, 2021 at 8:59 PM Rohan Drape <rohan.drape@gmail.com> wrote:
> hello list
>
> a very simple question i hope
>
> how do we access the guile posix/sockets functions from within an r6rs
> library?
>
> in ikarus there is (import (ikarus)), is it something similar?
>
> i see they are automatically present in the interpreter
>
> best,
> rohan
>
> $ guile --r6rs
> GNU Guile 3.0.4
> [...]
> scheme@(guile-user)> socket
> $1 = #<procedure socket (_ _ _)>
> scheme@(guile-user)>
> $ cat test.scm
> #!r6rs
> (library (test)
> (export udp-open)
> (import (rnrs))
> (define udp-open
> (lambda (h p)
> (let ((s (socket PF_INET SOCK_DGRAM 0)))
> (connect s AF_INET (inet-pton AF_INET h) p)
> (list s h p)))))
> $ guile --r6rs
> GNU Guile 3.0.4
> [...]
> scheme@(guile-user)> (import (test))
> ;;; compiling /home/rohan/opt/lib/r6rs/test.scm
> ;;; test.scm:9:0: warning: possibly unbound variable `socket'
> ;;; test.scm:9:0: warning: possibly unbound variable `PF_INET'
> ;;; test.scm:9:0: warning: possibly unbound variable `SOCK_DGRAM'
> [...]
>
next prev parent reply other threads:[~2021-01-23 5:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-23 1:00 r6rs and posix sockets Rohan Drape
2021-01-23 5:10 ` John Cowan [this message]
2021-01-23 8:53 ` Rohan Drape
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=CAD2gp_QgC2e-7YqE0wFgxCO9Z6gVfD4eALcZS59MNN0H3H4djg@mail.gmail.com \
--to=cowan@ccil.org \
--cc=guile-user@gnu.org \
--cc=rohan.drape@gmail.com \
/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).