|
Friday, March 19, 2004 |
Patrick's postings about Kali Scheme inspired me to start experimenting with sending continuations across the network using Sisc Scheme. My test code is in remote-send.scm. This should load and run in Sisc Scheme v1.8.7.
Sisc only allows serialisation to file currently so I added routines to
serialize to a binary buffer in memory. Then send this buffer across
the network. You can try it out by running two Sisc sessions, either on
the same machine, or different machines. One node runs the function
'message-listener' passing it the tcp port to listen on. The other node
runs 'send' passing it the host name and port of the listener. The
remaining arguments are a function to execute and the arguments to that
function.
The function passed is serialized by Sisc, sent across the network, deserialized on the other end and executed. For example:
(send "localhost" 9000 display "test")
This will display the work 'test' on the other machine. You can also
send functions that don't currently exist in the target machine. For
example, a continuation:
(define a #f)
(define (test1)
(display "one\n")
(call/cc (lambda (k) (set! a k)))
(display "two\n"))
(test1)
(send "localhost" 9000 a)
This displays "two" on the target machine. In this example the continuation is 4,180 bytes.
9:17:51 AM
|
|
© Copyright 2005 Chris Double.
|
|
|