I'm trying to make a Common Lisp front end to the Asymptote vector graphics language. I'd like to establish communication between a Lisp process and an Asymptote process and I have problems with this. Somehow Asymptote is hard to communicate with. The only working piece of code I have (stripped from xasy2asy.py) is in Python 2 and looks like this:

I'd love to implement this in Lisp (since I don't see another way of doing that). However, there's much to be desired about my real-life Lisp skills, and what's more I'm not much skilled in inter-process communication. I've been reading a lot these days, and I've got a mess of descriptors, sockets, and suchlike in my head. I'd be happy if you at least point me in the right direction: usocket, iolib, implementation dependent tools...

As for the result, of course I'd like it to be portable. Or at least SBCL and CLISP. Or at least SBCL.