Wasp Lisp was originally derived from MOSREF - the Mosquito Secure Remote Execution Framework. It includes an implementation of MOSREF so can do similar things that the original was built for.
Wasp feels a lot like Scheme. It has a REPL which you can use to try Lisp interactively. You can spawn lightweight threads and use channels to communicate between threads. Here's a simple example with a thread that loops forever, waits for data to be sent to a channel and then prints that out. From the REPL strings are interactively sent to the channel:
$ rlwrap ../wasp >> (define channel (make-queue)) :: [queue 98154C0] >> (define (looper channel) .. (forever .. (define data (wait channel)) .. (print data))) :: looper >> (spawn looper channel) :: [process looper] >> (send "hello\n" channel) hello :: [queue-output 9815500] >> (send "world\n" channel) world :: [queue-output 9815500]
Threads are co-operative in Wasp. You need to manually yield to switch from a thread. The following example doesn't manually yield and will constantly print 'a' to the terminal:
(begin (spawn (lambda () (forever (print "a\n")))) (spawn (lambda () (forever (print "b\n")))))
To yield you use the 'pause' function. Adding this to the 'forever' loop in the example above will switch between the two threads:
(begin (spawn (lambda () (forever (pause) (print "a\n")))) (spawn (lambda () (forever (pause) (print "b\n")))))
Wasp Lisp code can get compiled to a compact bytecode format using the 'waspc' command. This can produce a binary executable for the platform:
$ cat >test.ms (define (main) (print "hello world!\n")) $ waspc -exe hello test.ms BUILD: test BUILD: core/macro BUILD: core/config BUILD: site/config BUILD: core/file BUILD: core/module BUILD: core/io BUILD: core/macro BUILD: core/config BUILD: site/config BUILD: core/file BUILD: core/module BUILD: core/io BUILD: test $ chmod +x hello $ ./hello hello world!
There is quite a bit of example code, including a simple HTTP server:
$ rlwrap ../wasp >> (import "lib/http-file-server") :: #t >> (offer-http-file 2080 "/test" "text/plain" "Hello world!") :: [queue 985A1F0]
This serves the text 'Hello world!' when http://localhost:2080/test is requested. The Wasp VM site has an informal speed test of serving data comparing against THTTPD.