guile-user
[Top][All Lists]
Advanced

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

Re: sending list


From: Manuel Giraud
Subject: Re: sending list
Date: 12 Sep 2001 16:32:10 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Alex Shinn <address@hidden> writes:

>     Manuel> I don't understand how useful can be a "newly created
>     Manuel> output port" on which you have no control (is a socket, a
>     Manuel> file? which one?).
> 
> Neither, it's just an output port.  In Martin's example the port is
> passed as the argument to the (lambda (s) ...) expression.  Inside the
> procedure he writes to the s port, and when the procedure is done, all
> the output to s is collected and returned by the c-w-o-s expression as
> a single string.
>

Ok! so this use of c-w-o-s is just to convert a list to a string. It's
sad that the name `list->string' is already used by R5RS because IMHO
what is done here with c-w-o-s is the *true* behaviour of
`list->string'.

>     Manuel> Anyway, is it possible with this function and
>     Manuel> `call-with-input-string' to send a s-expression (as a
>     Manuel> string) over socket, retrieve it on the server side and
>     Manuel> evaluate it?
> 
> Sure, you just want to convert the s-expression to a string somehow.
> Scheme will also do this for you automatically if you use
> 
>   (write '(define a 8) port)
> 
> In this sense read and write are opposites, and anything you can read
> you can write.  The converse is not true, there are things like ports
> themselves and smobs which have a written representation but cannot be
> read back in.
> 

It works great! So now I can *easily* migrate my code everywhere I want to
... in fact everywhere there's a guile server launch.

I think it's time to remove all of these complex OSes from our
machines and simply install some guile servers ;-)

-- 
Jake:"See those berries? That's our breakfast! See that stream? That's
our drinking water!"
Daria:"See that skeleton? That's our future." 
-From "The Teachings Of Don Jake." 

_Manuel Giraud_



reply via email to

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