Common Lisp, Development, LISP, Python, Quantum Computing, Quantum Programming, Technology

Hacking D-Wave One in Common Lisp

Mostly for my own amusement, I’ve tried a variety of approaches to hacking D-Wave’s python pack in Common Lisp, from existing Python/Lisp bridges to Python-in-Lisp implementations to decompiling the binary in order to recreate C++ header files that could then be used as a basis for a direct CFFI bridge, without much success. Being that the D-Wave Developer Portal only ever offered a simulator of the company’s D-Wave One hardware for the Python language, and no C/C++ library with associated header files, this was a fairly significant problem as support for Python–Lisp bridges has always been extremely limited, and until very recently, such bridges did not support CPython libraries such as D-Wave’s Python Pack, or its dependencies such as Numpy. Enter burgled-batteries.

With the burgled-batteries library, I was hacking away at D-Wave’s Python Pack within the SBCL REPL in a matter of minutes. And according to the library’s author, it’s only the beginning. Support for Python introspection and calling Lisp from Python are in the works—but in the mean time, handy macros such as RUN and DEFPYFUN allow you to get at all aspects of a Python library in a manner familiar to those used to working with the CLPython or CFFI Common Lisp libraries.

Using burgled-batteries in its present state, it will now be a fairly straightforward task to recreate the Python Pack’s API in Common Lisp. Sadly, registration to D-Wave’s developer portal has been closed for some time (and very few developers registered for it in the first place), so the only person that will get to enjoy hacking away at a quantum computer in Common Lisp (as far as I know) is me.

That being said, I look forward to the continued development of burgled-batteries, and think it will become an invaluable tool for Lisp and Python hackers everywhere. Just think of all the libraries and frameworks we’ll get to add to Lisp!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s