guile-user
[Top][All Lists]
Advanced

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

Re: sending list


From: Martin Grabmueller
Subject: Re: sending list
Date: Wed, 12 Sep 2001 13:40:40 +0200

> From: Manuel Giraud <address@hidden>
> Date: 11 Sep 2001 12:05:37 +0200
> 
>         I was thinking of something that would be cool to have : be
>         able to send and receive list over a socket. So you can write
>         this kind of code : 
> 
>         ;;; Client
>         ;;; ...
>         (define message '(define a 8))
>         
>         (connect sock AF_INET 
>                  (car (hostent:addr-list (gethost sname))) port)
>         (send sock message)     
>         ;;; end of Client
> 
>         ;;; Server
>         ;;; ...
>         (let ((sock (car (accept sock))))
>           (eval (read sock)))
>         ;;; end of Server
> 
>         But the guile's send use the classical C's send. So is there a
>         guile guru out there to say if such a thing is feasible or
>         completely impossible.

You need to convert the list to a string before sending it to the
port.  Consider the following:

guile> (call-with-output-string (lambda (s) (write '(define a 8) s)))
"(define a 8)"

HTH,
  'martin



reply via email to

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