unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* r6rs and posix sockets
@ 2021-01-23  1:00 Rohan Drape
  2021-01-23  5:10 ` John Cowan
  0 siblings, 1 reply; 3+ messages in thread
From: Rohan Drape @ 2021-01-23  1:00 UTC (permalink / raw)
  To: guile-user

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: r6rs and posix sockets
  2021-01-23  1:00 r6rs and posix sockets Rohan Drape
@ 2021-01-23  5:10 ` John Cowan
  2021-01-23  8:53   ` Rohan Drape
  0 siblings, 1 reply; 3+ messages in thread
From: John Cowan @ 2021-01-23  5:10 UTC (permalink / raw)
  To: Rohan Drape; +Cc: guile-user

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: r6rs and posix sockets
  2021-01-23  5:10 ` John Cowan
@ 2021-01-23  8:53   ` Rohan Drape
  0 siblings, 0 replies; 3+ messages in thread
From: Rohan Drape @ 2021-01-23  8:53 UTC (permalink / raw)
  To: guile-user

hello - excellent! - thanks very kindly - rohan


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-23  8:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-23  1:00 r6rs and posix sockets Rohan Drape
2021-01-23  5:10 ` John Cowan
2021-01-23  8:53   ` Rohan Drape

unofficial mirror of guile-user@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guile-user/0 guile-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guile-user guile-user/ https://yhetil.org/guile-user \
		guile-user@gnu.org
	public-inbox-index guile-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.lisp.guile.user
	nntp://news.gmane.io/gmane.lisp.guile.user


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git