guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: r6rs and posix sockets


From: John Cowan
Subject: Re: r6rs and posix sockets
Date: Sat, 23 Jan 2021 00:10:51 -0500

(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'
> [...]
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]