--- /dev/null
+(import sam
+ matchable
+ (chicken process-context)
+ srfi-18)
+
+(define (send-startup-messages)
+ (send-message system 'print "Hello, what is your name?")
+ (send-message system 'read
+ (make-actor (lambda (self . message)
+ (print message)
+ (match message
+ ((name)
+ (send-message system 'print "Hello, " name "!")
+ 'done)))))
+
+ (thread-start!
+ (lambda ()
+ (thread-sleep! 10)
+ (send-message system 'print "Boo!"))))
+
+(let loop ((args (cdr (argv)))
+ (host "localhost")
+ (port 8000))
+ (match args
+ (((or "-h" "--help"))
+ (print "Usage: simple_test [ -h ] [ --port PORT ] [ --hostname host ]"))
+ (((or "-p" "--port") pstr rest ...)
+ (loop rest host (string->number pstr)))
+ (("--hostname" hstr rest ...)
+ (loop rest hstr port))
+ (()
+ (init-sam host port)
+ (print "-- Started SAM on " host ":" port " --\n")
+ (send-startup-messages)
+ (start-console))))