What if Elisp and Python Had a Child?

John Kitchin, as Irreal has covered many times, is doing a lot of excellent work with Org mode and Emacs. Most of his scientific computation is done in Python, a language he's been using for 15 years and is very comfortable with. He's managed to integrate Python and Org mode by using Babel code blocks.

He discovered, though, that it's a lot more fun to program in Lisp than in Python. That's something that many of us have discovered so I'm entirely sympathetic to is desire to do his scientific work in Lisp. The problem is that Python has really great support for scientific calculations that isn't generally available in Lisp environments. What's really needed, he says, is a way of accessing the Python library from Lisp. Happily, there is a way of doing this with Hy, a Lisp dialect that compiles to a Python abstract syntax tree that can executed by Python.

Kitchin tries a few simple experiments in his post and discovers that it's amazingly simple to write in Lisp and still have all the numerical goodness of Python. Take a look at his post to see easy and natural it is. If, like Kitchin, you have a large investment in Python knowledge, need the scientific libraries that Python provides, and would rather be writing in Lisp be sure to check out his post and then head over to the Hy site. It's pretty easy to install and get started with Hy so you can try it out with little effort.

Hat tip to Karl Voit for pointing me to Kitchin's post.

This entry was posted in General and tagged , , , . Bookmark the permalink.
  • Karl Voit

    Thanks for your hat tip. You're welcome.

    I am a Python person by myself. As I read Johns tweets, I installed Hy and read through two tutorials. However, I personally do prefer the syntax of Python so far. But I never got that much into Lisp to embrace its advantages I guess.

    We'll see.

    • jcs

      Of course you should use whatever works for you. Lisp syntax seems crazy and backwards when you see it for the first time but shortly you realize there really is no syntax to speak of and the real task is learning the run-time library.

      I agree with Kitchin: it is way more fun to program in Lisp but it's also true that it's an acquired taste.